Skip to content

Commit b69a0c1

Browse files
committed
Modify the task type to not contain any opaques; apparently these make LLVM cross.
1 parent 4cfc425 commit b69a0c1

File tree

1 file changed

+25
-6
lines changed

1 file changed

+25
-6
lines changed

src/comp/middle/trans.rs

+25-6
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,22 @@ fn T_opaque() -> TypeRef {
7979

8080
fn T_task() -> TypeRef {
8181
ret T_struct(vec(T_int(), // Refcount
82-
T_opaque())); // Rest is opaque for now
82+
T_int(), // Delegate pointer
83+
T_int(), // Stack segment pointer
84+
T_int(), // Runtime SP
85+
T_int(), // Rust SP
86+
T_int(), // GC chain
87+
T_int(), // Domain pointer
88+
T_int() // Crate cache pointer
89+
));
90+
}
91+
92+
fn T_double() -> TypeRef {
93+
ret llvm.LLVMDoubleType();
94+
}
95+
96+
fn T_taskptr() -> TypeRef {
97+
ret T_ptr(T_task());
8398
}
8499

85100

@@ -121,15 +136,19 @@ fn decl_cdecl_fn(ModuleRef llmod, str name,
121136
}
122137

123138
fn decl_glue(ModuleRef llmod, str s) -> ValueRef {
124-
ret decl_cdecl_fn(llmod, s, vec(T_ptr(T_task())), T_nil());
139+
ret decl_cdecl_fn(llmod, s, vec(T_taskptr()), T_nil());
125140
}
126141

127142
fn decl_upcall(ModuleRef llmod, uint _n) -> ValueRef {
143+
// It doesn't actually matter what type we come up with here, at the
144+
// moment, as we cast the upcall function pointers to int before passing
145+
// them to the indirect upcall-invocation glue. But eventually we'd like
146+
// to call them directly, once we have a calling convention worked out.
128147
let int n = _n as int;
129148
let str s = abi.upcall_glue_name(n);
130149
let vec[TypeRef] args =
131-
vec(T_ptr(T_task()), // taskptr
132-
T_int()) // callee
150+
vec(T_taskptr(), // taskptr
151+
T_int()) // callee
133152
+ _vec.init_elt[TypeRef](T_int(), n as uint);
134153

135154
ret decl_cdecl_fn(llmod, s, args, T_int());
@@ -139,7 +158,7 @@ fn get_upcall(@trans_ctxt cx, str name, int n_args) -> ValueRef {
139158
if (cx.upcalls.contains_key(name)) {
140159
ret cx.upcalls.get(name);
141160
}
142-
auto inputs = vec(T_ptr(T_task()));
161+
auto inputs = vec(T_taskptr());
143162
inputs += _vec.init_elt[TypeRef](T_int(), n_args as uint);
144163
auto output = T_nil();
145164
auto f = decl_cdecl_fn(cx.llmod, name, inputs, output);
@@ -213,7 +232,7 @@ fn trans_block(@fn_ctxt cx, &ast.block b, terminator term) {
213232

214233
fn trans_fn(@trans_ctxt cx, &ast._fn f) {
215234
let vec[TypeRef] args = vec(T_ptr(T_int()), // outptr.
216-
T_ptr(T_task()) // taskptr
235+
T_taskptr() // taskptr
217236
);
218237
let ValueRef llfn = decl_cdecl_fn(cx.llmod, cx.path, args, T_nil());
219238
let ValueRef lloutptr = llvm.LLVMGetParam(llfn, 0u);

0 commit comments

Comments
 (0)