about summary refs log tree commit diff
path: root/src/rt/rust_upcall.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2011-12-05 13:19:02 -0800
committerBrian Anderson <banderson@mozilla.com>2011-12-05 14:44:15 -0800
commit98cd96ce96c8be7248e3d375053938354c82878a (patch)
tree5030128464a4ec1726efafc6a7685d1812b92899 /src/rt/rust_upcall.cpp
parent1720bc2e81c274b463d84bec7484dbc5da87333f (diff)
downloadrust-98cd96ce96c8be7248e3d375053938354c82878a.tar.gz
rust-98cd96ce96c8be7248e3d375053938354c82878a.zip
test: Add more tests for stack growth
Diffstat (limited to 'src/rt/rust_upcall.cpp')
-rw-r--r--src/rt/rust_upcall.cpp14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index a8f39cf91da..e6e89c62cc0 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -209,14 +209,22 @@ upcall_dynastack_free(void *ptr) {
     return rust_scheduler::get_task()->dynastack.free(ptr);
 }
 
+extern "C" void record_sp(void *limit);
+
 /**
- * Allocates |nbytes| bytes in the C stack and returns a pointer to the start
- * of the allocated space.
+ * Switch to the C stack and call the given function, passing a single pointer
+ * argument.
  */
 extern "C" CDECL void
 upcall_call_shim_on_c_stack(void *args, void *fn_ptr) {
-    rust_scheduler *sched = rust_scheduler::get_task()->sched;
+    // FIXME (1226) - The shim functions generated by rustc contain the
+    // morestack prologue, so we need to let them know they have enough
+    // stack.
+    record_sp(0);
+    rust_task *task = rust_scheduler::get_task();
+    rust_scheduler *sched = task->sched;
     sched->c_context.call_shim_on_c_stack(args, fn_ptr);
+    task->record_stack_limit();
 }
 
 struct rust_new_stack2_args {