summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorAaron Turon <aturon@mozilla.com>2014-12-07 00:32:50 -0800
committerAaron Turon <aturon@mozilla.com>2014-12-18 23:31:51 -0800
commit14c1a103bc3f78721df1dc860a75a477c8275e3a (patch)
tree183d003481cc5c7f96f59432bc52805c5d801178 /src/libstd/rt
parentd8e4780b0b59636cd979a60434a407142e407ac9 (diff)
downloadrust-14c1a103bc3f78721df1dc860a75a477c8275e3a.tar.gz
rust-14c1a103bc3f78721df1dc860a75a477c8275e3a.zip
Revise rt::unwind
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/mod.rs4
-rw-r--r--src/libstd/rt/unwind.rs42
2 files changed, 6 insertions, 40 deletions
diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs
index a3b1d831a38..44794d2b957 100644
--- a/src/libstd/rt/mod.rs
+++ b/src/libstd/rt/mod.rs
@@ -72,10 +72,6 @@ mod macros;
 
 // These should be refactored/moved/made private over time
 pub mod util;
-<<<<<<< HEAD
-=======
-pub mod task;
->>>>>>> Remove rt::{local, local_data, thread_local_storage}
 pub mod unwind;
 
 mod args;
diff --git a/src/libstd/rt/unwind.rs b/src/libstd/rt/unwind.rs
index 1ac06270851..decf7cfb60a 100644
--- a/src/libstd/rt/unwind.rs
+++ b/src/libstd/rt/unwind.rs
@@ -72,16 +72,9 @@ use mem;
 use raw::Closure;
 use libc::c_void;
 
-use rt::local::Local;
-use rt::task::Task;
-
+use sys_common::thread_info;
 use rt::libunwind as uw;
 
-#[allow(missing_copy_implementations)]
-pub struct Unwinder {
-    unwinding: bool,
-}
-
 struct Exception {
     uwe: uw::_Unwind_Exception,
     cause: Option<Box<Any + Send>>,
@@ -104,18 +97,6 @@ static CALLBACKS: [atomic::AtomicUint, ..MAX_CALLBACKS] =
          atomic::INIT_ATOMIC_UINT, atomic::INIT_ATOMIC_UINT];
 static CALLBACK_CNT: atomic::AtomicUint = atomic::INIT_ATOMIC_UINT;
 
-impl Unwinder {
-    pub fn new() -> Unwinder {
-        Unwinder {
-            unwinding: false,
-        }
-    }
-
-    pub fn unwinding(&self) -> bool {
-        self.unwinding
-    }
-}
-
 /// Invoke a closure, capturing the cause of panic if one occurs.
 ///
 /// This function will return `None` if the closure did not panic, and will
@@ -556,7 +537,7 @@ pub fn begin_unwind<M: Any + Send>(msg: M, file_line: &(&'static str, uint)) ->
 /// we need the `Any` object anyway, we're not just creating it to
 /// avoid being generic.)
 ///
-/// Do this split took the LLVM IR line counts of `fn main() { panic!()
+/// Doing this split took the LLVM IR line counts of `fn main() { panic!()
 /// }` from ~1900/3700 (-O/no opts) to 180/590.
 #[inline(never)] #[cold] // this is the slow path, please never inline this
 fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) -> ! {
@@ -583,27 +564,16 @@ fn begin_unwind_inner(msg: Box<Any + Send>, file_line: &(&'static str, uint)) ->
     };
 
     // Now that we've run all the necessary unwind callbacks, we actually
-    // perform the unwinding. If we don't have a task, then it's time to die
-    // (hopefully someone printed something about this).
-    let mut task: Box<Task> = match Local::try_take() {
-        Some(task) => task,
-        None => rust_panic(msg),
-    };
-
-    if task.unwinder.unwinding {
-        // If a task panics while it's already unwinding then we
+    // perform the unwinding.
+    if thread_info::unwinding() {
+        // If a thread panics while it's already unwinding then we
         // have limited options. Currently our preference is to
         // just abort. In the future we may consider resuming
         // unwinding or otherwise exiting the task cleanly.
         rterrln!("task failed during unwinding. aborting.");
         unsafe { intrinsics::abort() }
     }
-    task.unwinder.unwinding = true;
-
-    // Put the task back in TLS because the unwinding process may run code which
-    // requires the task. We need a handle to its unwinder, however, so after
-    // this we unsafely extract it and continue along.
-    Local::put(task);
+    thread_info::set_unwinding(true);
     rust_panic(msg);
 }