about summary refs log tree commit diff
path: root/src/comp
diff options
context:
space:
mode:
authorGraydon Hoare <graydon@mozilla.com>2010-09-24 15:22:48 -0700
committerGraydon Hoare <graydon@mozilla.com>2010-09-24 15:22:48 -0700
commitb69a0c137c344ae722abc176f9d7ea27f7bddd3e (patch)
tree6597c25a27a48a0404bded78657b3872432b9880 /src/comp
parent4cfc4250bf721d5946b4f91c7b561dd57a00cc96 (diff)
downloadrust-b69a0c137c344ae722abc176f9d7ea27f7bddd3e.tar.gz
rust-b69a0c137c344ae722abc176f9d7ea27f7bddd3e.zip
Modify the task type to not contain any opaques; apparently these make LLVM cross.
Diffstat (limited to 'src/comp')
-rw-r--r--src/comp/middle/trans.rs31
1 files changed, 25 insertions, 6 deletions
diff --git a/src/comp/middle/trans.rs b/src/comp/middle/trans.rs
index e2dfc7c1b29..c67e45cca57 100644
--- a/src/comp/middle/trans.rs
+++ b/src/comp/middle/trans.rs
@@ -79,7 +79,22 @@ fn T_opaque() -> TypeRef {
 
 fn T_task() -> TypeRef {
     ret T_struct(vec(T_int(),      // Refcount
-                     T_opaque())); // Rest is opaque for now
+                     T_int(),      // Delegate pointer
+                     T_int(),      // Stack segment pointer
+                     T_int(),      // Runtime SP
+                     T_int(),      // Rust SP
+                     T_int(),      // GC chain
+                     T_int(),      // Domain pointer
+                     T_int()       // Crate cache pointer
+                     ));
+}
+
+fn T_double() -> TypeRef {
+    ret llvm.LLVMDoubleType();
+}
+
+fn T_taskptr() -> TypeRef {
+    ret T_ptr(T_task());
 }
 
 
@@ -121,15 +136,19 @@ fn decl_cdecl_fn(ModuleRef llmod, str name,
 }
 
 fn decl_glue(ModuleRef llmod, str s) -> ValueRef {
-    ret decl_cdecl_fn(llmod, s, vec(T_ptr(T_task())), T_nil());
+    ret decl_cdecl_fn(llmod, s, vec(T_taskptr()), T_nil());
 }
 
 fn decl_upcall(ModuleRef llmod, uint _n) -> ValueRef {
+    // It doesn't actually matter what type we come up with here, at the
+    // moment, as we cast the upcall function pointers to int before passing
+    // them to the indirect upcall-invocation glue.  But eventually we'd like
+    // to call them directly, once we have a calling convention worked out.
     let int n = _n as int;
     let str s = abi.upcall_glue_name(n);
     let vec[TypeRef] args =
-        vec(T_ptr(T_task()), // taskptr
-            T_int())         // callee
+        vec(T_taskptr(), // taskptr
+            T_int())     // callee
         + _vec.init_elt[TypeRef](T_int(), n as uint);
 
     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 {
     if (cx.upcalls.contains_key(name)) {
         ret cx.upcalls.get(name);
     }
-    auto inputs = vec(T_ptr(T_task()));
+    auto inputs = vec(T_taskptr());
     inputs += _vec.init_elt[TypeRef](T_int(), n_args as uint);
     auto output = T_nil();
     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) {
 
 fn trans_fn(@trans_ctxt cx, &ast._fn f) {
     let vec[TypeRef] args = vec(T_ptr(T_int()), // outptr.
-                                T_ptr(T_task()) // taskptr
+                                T_taskptr()     // taskptr
                                 );
     let ValueRef llfn = decl_cdecl_fn(cx.llmod, cx.path, args, T_nil());
     let ValueRef lloutptr = llvm.LLVMGetParam(llfn, 0u);