about summary refs log tree commit diff
path: root/src/rt/rust_upcall.cpp
diff options
context:
space:
mode:
authorBrian Anderson <banderson@mozilla.com>2013-04-22 17:15:31 -0700
committerBrian Anderson <banderson@mozilla.com>2013-04-22 17:15:31 -0700
commit42c0f88232847e97e6cf3578ef197d1942bba44d (patch)
tree6167cb170f891dad4674e2c186f785d6a0160b5d /src/rt/rust_upcall.cpp
parent5fbb0949a53a6ac51c6d9b187ef4c464e52ae536 (diff)
downloadrust-42c0f88232847e97e6cf3578ef197d1942bba44d.tar.gz
rust-42c0f88232847e97e6cf3578ef197d1942bba44d.zip
core::rt: Add unwinding to newsched tasks
Diffstat (limited to 'src/rt/rust_upcall.cpp')
-rw-r--r--src/rt/rust_upcall.cpp16
1 files changed, 13 insertions, 3 deletions
diff --git a/src/rt/rust_upcall.cpp b/src/rt/rust_upcall.cpp
index 9f39e1433fc..34236c36c14 100644
--- a/src/rt/rust_upcall.cpp
+++ b/src/rt/rust_upcall.cpp
@@ -272,7 +272,13 @@ upcall_rust_personality(int version,
     s_rust_personality_args args = {(_Unwind_Reason_Code)0,
                                     version, actions, exception_class,
                                     ue_header, context};
-    rust_task *task = rust_get_current_task();
+    rust_task *task = rust_try_get_current_task();
+
+    if (task == NULL) {
+        // Assuming we're running with the new scheduler
+        upcall_s_rust_personality(&args);
+        return args.retval;
+    }
 
     // The personality function is run on the stack of the
     // last function that threw or landed, which is going
@@ -309,8 +315,12 @@ upcall_del_stack() {
 // needs to acquire the value of the stack pointer
 extern "C" CDECL void
 upcall_reset_stack_limit() {
-    rust_task *task = rust_get_current_task();
-    task->reset_stack_limit();
+    rust_task *task = rust_try_get_current_task();
+    if (task != NULL) {
+        task->reset_stack_limit();
+    } else {
+        // We must be in a newsched task
+    }
 }
 
 //