about summary refs log tree commit diff
diff options
context:
space:
mode:
authorJosh Matthews <josh@joshmatthews.net>2013-04-10 10:28:26 -0400
committerJosh Matthews <josh@joshmatthews.net>2013-04-21 22:41:43 +0200
commit5cc6a0bf327e84569166d0ae7c07615e5afd5238 (patch)
tree7fa9fc6e5755d1b0f76947486f5609cc7ec60234
parent07e087bf310e7e7911bf05efa36a2cdb57855a4e (diff)
downloadrust-5cc6a0bf327e84569166d0ae7c07615e5afd5238.tar.gz
rust-5cc6a0bf327e84569166d0ae7c07615e5afd5238.zip
rt: Make the C stack segment accessible to runtime users.
-rw-r--r--src/libcore/gc.rs1
-rw-r--r--src/rt/rust_builtin.cpp5
-rw-r--r--src/rt/rust_task.h1
-rw-r--r--src/rt/rustrt.def.in1
4 files changed, 8 insertions, 0 deletions
diff --git a/src/libcore/gc.rs b/src/libcore/gc.rs
index 9fd9ac3a8c8..7262c4f58f5 100644
--- a/src/libcore/gc.rs
+++ b/src/libcore/gc.rs
@@ -73,6 +73,7 @@ pub mod rustrt {
         pub unsafe fn rust_gc_metadata() -> *Word;
 
         pub unsafe fn rust_get_stack_segment() -> *StackSegment;
+        pub unsafe fn rust_get_c_stack() -> *StackSegment;
     }
 }
 
diff --git a/src/rt/rust_builtin.cpp b/src/rt/rust_builtin.cpp
index 3c6cc9d9245..a2bbaf80c0a 100644
--- a/src/rt/rust_builtin.cpp
+++ b/src/rt/rust_builtin.cpp
@@ -544,6 +544,11 @@ rust_get_stack_segment() {
     return rust_get_current_task()->stk;
 }
 
+extern "C" CDECL stk_seg *
+rust_get_c_stack() {
+    return rust_get_current_task()->get_c_stack();
+}
+
 extern "C" CDECL void
 start_task(rust_task *target, fn_env_pair *f) {
     target->start(f->f, f->env, NULL);
diff --git a/src/rt/rust_task.h b/src/rt/rust_task.h
index 00d20fefc0e..a529db7d317 100644
--- a/src/rt/rust_task.h
+++ b/src/rt/rust_task.h
@@ -367,6 +367,7 @@ public:
     void call_on_c_stack(void *args, void *fn_ptr);
     void call_on_rust_stack(void *args, void *fn_ptr);
     bool have_c_stack() { return c_stack != NULL; }
+    stk_seg *get_c_stack() { return c_stack; }
 
     rust_task_state get_state() { return state; }
     rust_cond *get_cond() { return cond; }
diff --git a/src/rt/rustrt.def.in b/src/rt/rustrt.def.in
index 73dbe661d3f..b7ca28d5960 100644
--- a/src/rt/rustrt.def.in
+++ b/src/rt/rustrt.def.in
@@ -48,6 +48,7 @@ rust_task_yield
 rust_task_is_unwinding
 rust_get_task
 rust_get_stack_segment
+rust_get_c_stack
 rust_log_str
 start_task
 vec_reserve_shared_actual