about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorValerii Hiora <valerii.hiora@gmail.com>2014-06-13 10:18:12 +0300
committerValerii Hiora <valerii.hiora@gmail.com>2014-06-13 10:18:12 +0300
commitebc6474668ec60cc793af0f48143bf33d984deb4 (patch)
tree5e03b151befb417b1d5262b45ce19a69b4fe5651 /src
parent70a79a9e0527fab74d8c2d2b49886b41bdd878f5 (diff)
downloadrust-ebc6474668ec60cc793af0f48143bf33d984deb4.tar.gz
rust-ebc6474668ec60cc793af0f48143bf33d984deb4.zip
Cosmetic fixes & comments
Diffstat (limited to 'src')
-rw-r--r--src/librustrt/libunwind.rs12
-rw-r--r--src/librustrt/unwind.rs1
-rw-r--r--src/libstd/rt/backtrace.rs11
-rw-r--r--src/rt/arch/arm/record_sp.S6
4 files changed, 19 insertions, 11 deletions
diff --git a/src/librustrt/libunwind.rs b/src/librustrt/libunwind.rs
index 50c2aba2b5c..2d58c1bee15 100644
--- a/src/librustrt/libunwind.rs
+++ b/src/librustrt/libunwind.rs
@@ -97,10 +97,14 @@ extern {}
 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 @@ extern "C" {
 #[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)
 }
diff --git a/src/librustrt/unwind.rs b/src/librustrt/unwind.rs
index e60c50f0adb..5b941c9d5aa 100644
--- a/src/librustrt/unwind.rs
+++ b/src/librustrt/unwind.rs
@@ -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,
diff --git a/src/libstd/rt/backtrace.rs b/src/libstd/rt/backtrace.rs
index 16b598b3ae7..0e3e7cc796a 100644
--- a/src/libstd/rt/backtrace.rs
+++ b/src/libstd/rt/backtrace.rs
@@ -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 @@ mod imp {
 
         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| {
diff --git a/src/rt/arch/arm/record_sp.S b/src/rt/arch/arm/record_sp.S
index 94cfcff039e..d0e9b81b95a 100644
--- a/src/rt/arch/arm/record_sp.S
+++ b/src/rt/arch/arm/record_sp.S
@@ -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__)