@@ -79,7 +79,22 @@ fn T_opaque() -> TypeRef {
79
79
80
80
fn T_task ( ) -> TypeRef {
81
81
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 ( ) ) ;
83
98
}
84
99
85
100
@@ -121,15 +136,19 @@ fn decl_cdecl_fn(ModuleRef llmod, str name,
121
136
}
122
137
123
138
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 ( ) ) ;
125
140
}
126
141
127
142
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.
128
147
let int n = _n as int ;
129
148
let str s = abi. upcall_glue_name ( n) ;
130
149
let vec[ TypeRef ] args =
131
- vec ( T_ptr ( T_task ( ) ) , // taskptr
132
- T_int ( ) ) // callee
150
+ vec ( T_taskptr ( ) , // taskptr
151
+ T_int ( ) ) // callee
133
152
+ _vec. init_elt [ TypeRef ] ( T_int ( ) , n as uint ) ;
134
153
135
154
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 {
139
158
if ( cx. upcalls . contains_key ( name) ) {
140
159
ret cx. upcalls . get ( name) ;
141
160
}
142
- auto inputs = vec ( T_ptr ( T_task ( ) ) ) ;
161
+ auto inputs = vec ( T_taskptr ( ) ) ;
143
162
inputs += _vec. init_elt [ TypeRef ] ( T_int ( ) , n_args as uint ) ;
144
163
auto output = T_nil ( ) ;
145
164
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) {
213
232
214
233
fn trans_fn( @trans_ctxt cx, & ast. _fn f) {
215
234
let vec[ TypeRef ] args = vec( T_ptr ( T_int ( ) ) , // outptr.
216
- T_ptr ( T_task ( ) ) // taskptr
235
+ T_taskptr ( ) // taskptr
217
236
) ;
218
237
let ValueRef llfn = decl_cdecl_fn( cx. llmod, cx. path, args, T_nil ( ) ) ;
219
238
let ValueRef lloutptr = llvm. LLVMGetParam ( llfn, 0 u) ;
0 commit comments