about summary refs log tree commit diff
diff options
context:
space:
mode:
authorTom Lee <github@tomlee.co>2013-05-24 20:18:20 -0700
committerTom Lee <github@tomlee.co>2013-05-27 17:13:01 -0700
commitcddd274e4defa86820a7a4218f6f55a440b2f82f (patch)
treea0e5087ddbfffba07d71eeff1a2f943d5f62d2cd
parent67283eaad2f53e19ae963e2b0a04b65826568336 (diff)
downloadrust-cddd274e4defa86820a7a4218f6f55a440b2f82f.tar.gz
rust-cddd274e4defa86820a7a4218f6f55a440b2f82f.zip
Add _RUST_STAGE0 #ifdefs
-rw-r--r--src/rt/rust_builtin.cpp4
-rw-r--r--src/rt/rust_task.cpp8
-rw-r--r--src/rt/rust_type.h8
3 files changed, 20 insertions, 0 deletions
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 99fd46737e0..cf7c0777057 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -754,7 +754,11 @@ public:
 
     virtual void run() {
         record_sp_limit(0);
+#ifdef _RUST_STAGE0
+        fn.f(NULL, fn.env, NULL);
+#else
         fn.f(fn.env, NULL);
+#endif
     }
 };
 
diff --git a/src/rt/rust_task.cpp b/src/rt/rust_task.cpp
index 28d36a4bf88..b5ecb166175 100644
--- a/src/rt/rust_task.cpp
+++ b/src/rt/rust_task.cpp
@@ -162,7 +162,11 @@ void task_start_wrapper(spawn_args *a)
 
     bool threw_exception = false;
     try {
+#ifdef _RUST_STAGE0
+        a->f(NULL, a->envptr, a->argptr);
+#else
         a->f(a->envptr, a->argptr);
+#endif
     } catch (rust_task *ex) {
         assert(ex == task && "Expected this task to be thrown for unwinding");
         threw_exception = true;
@@ -183,7 +187,11 @@ void task_start_wrapper(spawn_args *a)
     if(env) {
         // free the environment (which should be a unique closure).
         const type_desc *td = env->td;
+#ifdef _RUST_STAGE0
+        td->drop_glue(NULL, NULL, NULL, box_body(env));
+#else
         td->drop_glue(NULL, NULL, box_body(env));
+#endif
         task->kernel->region()->free(env);
     }
 
diff --git a/src/rt/rust_type.h b/src/rt/rust_type.h
index 6d36d2c960a..b50c08379de 100644
--- a/src/rt/rust_type.h
+++ b/src/rt/rust_type.h
@@ -21,11 +21,19 @@ struct rust_opaque_box;
 // - the main function: has a NULL environment, but uses the void* arg
 // - unique closures of type fn~(): have a non-NULL environment, but
 //   no arguments (and hence the final void*) is harmless
+#ifdef _RUST_STAGE0
+typedef void (*CDECL spawn_fn)(void *, rust_opaque_box*, void *);
+#else
 typedef void (*CDECL spawn_fn)(rust_opaque_box*, void *);
+#endif
 
 struct type_desc;
 
+#ifdef _RUST_STAGE0
+typedef void CDECL (glue_fn)(void *, void *, const type_desc **, void *);
+#else
 typedef void CDECL (glue_fn)(void *, const type_desc **, void *);
+#endif
 
 // Corresponds to the boxed data in the @ region.  The body follows the
 // header; you can obtain a ptr via box_body() below.