]> git.lizzy.rs Git - rust.git/commitdiff
Cosmetic fixes & comments
authorValerii Hiora <valerii.hiora@gmail.com>
Fri, 13 Jun 2014 07:18:12 +0000 (10:18 +0300)
committerValerii Hiora <valerii.hiora@gmail.com>
Fri, 13 Jun 2014 07:18:12 +0000 (10:18 +0300)
src/librustrt/libunwind.rs
src/librustrt/unwind.rs
src/libstd/rt/backtrace.rs
src/rt/arch/arm/record_sp.S

index 50c2aba2b5cb11abed98276e1d9d5c4f4a2254ff..2d58c1bee15bd9aa0c480342945a77dff7a56653 100644 (file)
@@ -97,10 +97,14 @@ pub enum _Unwind_Context {}
 extern "C" {
     // iOS on armv7 uses SjLj exceptions and requires to link
     // agains corresponding routine (..._SjLj_...)
-    // So here we just skip linking for iOS
     #[cfg(not(target_os = "ios", target_arch = "arm"))]
     pub fn _Unwind_RaiseException(exception: *_Unwind_Exception)
-                -> _Unwind_Reason_Code;
+                                  -> _Unwind_Reason_Code;
+
+    #[cfg(target_os = "ios", target_arch = "arm")]
+    fn _Unwind_SjLj_RaiseException(e: *_Unwind_Exception)
+                                   -> _Unwind_Reason_Code;
+
     pub fn _Unwind_DeleteException(exception: *_Unwind_Exception);
 }
 
@@ -111,9 +115,5 @@ pub fn _Unwind_RaiseException(exception: *_Unwind_Exception)
 #[inline(always)]
 pub unsafe fn _Unwind_RaiseException(exc: *_Unwind_Exception)
                                      -> _Unwind_Reason_Code {
-    extern "C" {
-        fn _Unwind_SjLj_RaiseException(e: *_Unwind_Exception)
-                                       -> _Unwind_Reason_Code; }
-
     _Unwind_SjLj_RaiseException(exc)
 }
index e60c50f0adb43b6d063177e1f60dce5b6cd9cc3a..5b941c9d5aa39246875948e956146180c2af7bce 100644 (file)
@@ -303,7 +303,6 @@ pub mod eabi {
     use libc::c_int;
 
     extern "C" {
-        #[cfg(target_os = "ios", target_arch = "arm")]
         fn __gcc_personality_sj0(version: c_int,
                                 actions: uw::_Unwind_Action,
                                 exception_class: uw::_Unwind_Exception_Class,
index 16b598b3ae7b9dfbcee72f3db8764dab53b4010e..0e3e7cc796a3d8d6ee4c79c77b611cb6e340ebfb 100644 (file)
@@ -248,6 +248,11 @@ mod imp {
     /// _Unwind_Backtrace is even not available there. Still,
     /// backtraces could be extracted using a backtrace function,
     /// which thanks god is public
+    ///
+    /// As mentioned in a huge comment block above, backtrace doesn't
+    /// play well with green threads, so while it is extremely nice
+    /// and simple to use it should be used only on iOS devices as the
+    /// only viable option.
     #[cfg(target_os = "ios", target_arch = "arm")]
     #[inline(never)]
     pub fn write(w: &mut Writer) -> IoResult<()> {
@@ -267,9 +272,9 @@ pub fn write(w: &mut Writer) -> IoResult<()> {
 
         try!(writeln!(w, "stack backtrace:"));
         // 100 lines should be enough
-        static size: libc::c_int = 100;
-        let mut buf: [*libc::c_void, ..size] = unsafe {mem::zeroed()};
-        let cnt = unsafe { backtrace(buf.as_mut_ptr(), size) as uint};
+        static SIZE: libc::c_int = 100;
+        let mut buf: [*libc::c_void, ..SIZE] = unsafe {mem::zeroed()};
+        let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE) as uint};
 
         // skipping the first one as it is write itself
         result::fold_(range(1, cnt).map(|i| {
index 94cfcff039e4a3f50d86686c7a42d577d0894030..d0e9b81b95a9bfbe03a1268100afcfafd7afc2fb 100644 (file)
@@ -1,4 +1,8 @@
-// Do not compile anything here for iOS
+// Do not compile anything here for iOS because split stacks
+// are disabled at all and do not need any runtime support.
+//
+// See also comments in librustrt/stack.rs about why it was
+// disabled and how it could be implemented in case of need.
 #if !defined(__APPLE__)
 // Mark stack as non-executable
 #if defined(__linux__) && defined(__ELF__)