Skip to content

Commit ebc6474

Browse files
committed
Cosmetic fixes & comments
1 parent 70a79a9 commit ebc6474

File tree

4 files changed

+19
-11
lines changed

4 files changed

+19
-11
lines changed

src/librustrt/libunwind.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,10 +97,14 @@ extern {}
9797
extern "C" {
9898
// iOS on armv7 uses SjLj exceptions and requires to link
9999
// agains corresponding routine (..._SjLj_...)
100-
// So here we just skip linking for iOS
101100
#[cfg(not(target_os = "ios", target_arch = "arm"))]
102101
pub fn _Unwind_RaiseException(exception: *_Unwind_Exception)
103-
-> _Unwind_Reason_Code;
102+
-> _Unwind_Reason_Code;
103+
104+
#[cfg(target_os = "ios", target_arch = "arm")]
105+
fn _Unwind_SjLj_RaiseException(e: *_Unwind_Exception)
106+
-> _Unwind_Reason_Code;
107+
104108
pub fn _Unwind_DeleteException(exception: *_Unwind_Exception);
105109
}
106110

@@ -111,9 +115,5 @@ extern "C" {
111115
#[inline(always)]
112116
pub unsafe fn _Unwind_RaiseException(exc: *_Unwind_Exception)
113117
-> _Unwind_Reason_Code {
114-
extern "C" {
115-
fn _Unwind_SjLj_RaiseException(e: *_Unwind_Exception)
116-
-> _Unwind_Reason_Code; }
117-
118118
_Unwind_SjLj_RaiseException(exc)
119119
}

src/librustrt/unwind.rs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,6 @@ pub mod eabi {
303303
use libc::c_int;
304304

305305
extern "C" {
306-
#[cfg(target_os = "ios", target_arch = "arm")]
307306
fn __gcc_personality_sj0(version: c_int,
308307
actions: uw::_Unwind_Action,
309308
exception_class: uw::_Unwind_Exception_Class,

src/libstd/rt/backtrace.rs

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,11 @@ mod imp {
248248
/// _Unwind_Backtrace is even not available there. Still,
249249
/// backtraces could be extracted using a backtrace function,
250250
/// which thanks god is public
251+
///
252+
/// As mentioned in a huge comment block above, backtrace doesn't
253+
/// play well with green threads, so while it is extremely nice
254+
/// and simple to use it should be used only on iOS devices as the
255+
/// only viable option.
251256
#[cfg(target_os = "ios", target_arch = "arm")]
252257
#[inline(never)]
253258
pub fn write(w: &mut Writer) -> IoResult<()> {
@@ -267,9 +272,9 @@ mod imp {
267272

268273
try!(writeln!(w, "stack backtrace:"));
269274
// 100 lines should be enough
270-
static size: libc::c_int = 100;
271-
let mut buf: [*libc::c_void, ..size] = unsafe {mem::zeroed()};
272-
let cnt = unsafe { backtrace(buf.as_mut_ptr(), size) as uint};
275+
static SIZE: libc::c_int = 100;
276+
let mut buf: [*libc::c_void, ..SIZE] = unsafe {mem::zeroed()};
277+
let cnt = unsafe { backtrace(buf.as_mut_ptr(), SIZE) as uint};
273278

274279
// skipping the first one as it is write itself
275280
result::fold_(range(1, cnt).map(|i| {

src/rt/arch/arm/record_sp.S

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,8 @@
1-
// Do not compile anything here for iOS
1+
// Do not compile anything here for iOS because split stacks
2+
// are disabled at all and do not need any runtime support.
3+
//
4+
// See also comments in librustrt/stack.rs about why it was
5+
// disabled and how it could be implemented in case of need.
26
#if !defined(__APPLE__)
37
// Mark stack as non-executable
48
#if defined(__linux__) && defined(__ELF__)

0 commit comments

Comments
 (0)