diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-07-27 13:41:35 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-08-10 16:35:44 -0700 |
| commit | 7a3fdfbf674a08b7f6fd32c9124e52924a2f9a1c (patch) | |
| tree | 5553605e8d9ac7fc23cfec8f689f6c923e78abdd /src/libstd/sys/unix/thread.rs | |
| parent | d03456183e85fe7bd465bbe7c8f67885a2528444 (diff) | |
| download | rust-7a3fdfbf674a08b7f6fd32c9124e52924a2f9a1c.tar.gz rust-7a3fdfbf674a08b7f6fd32c9124e52924a2f9a1c.zip | |
Remove morestack support
This commit removes all morestack support from the compiler which entails: * Segmented stacks are no longer emitted in codegen. * We no longer build or distribute libmorestack.a * The `stack_exhausted` lang item is no longer required The only current use of the segmented stack support in LLVM is to detect stack overflow. This is no longer really required, however, because we already have guard pages for all threads and registered signal handlers watching for a segfault on those pages (to print out a stack overflow message). Additionally, major platforms (aka Windows) already don't use morestack. This means that Rust is by default less likely to catch stack overflows because if a function takes up more than one page of stack space it won't hit the guard page. This is what the purpose of morestack was (to catch this case), but it's better served with stack probes which have more cross platform support and no runtime support necessary. Until LLVM supports this for all platform it looks like morestack isn't really buying us much. cc #16012 (still need stack probes) Closes #26458 (a drive-by fix to help diagnostics on stack overflow)
Diffstat (limited to 'src/libstd/sys/unix/thread.rs')
| -rw-r--r-- | src/libstd/sys/unix/thread.rs | 5 |
1 files changed, 1 insertions, 4 deletions
diff --git a/src/libstd/sys/unix/thread.rs b/src/libstd/sys/unix/thread.rs index 67ecd4d9229..ea1bfbd9b7d 100644 --- a/src/libstd/sys/unix/thread.rs +++ b/src/libstd/sys/unix/thread.rs @@ -23,7 +23,6 @@ use ptr; use sys::os; use time::Duration; -use sys_common::stack::RED_ZONE; use sys_common::thread::*; pub struct Thread { @@ -43,8 +42,7 @@ impl Thread { let mut attr: libc::pthread_attr_t = mem::zeroed(); assert_eq!(pthread_attr_init(&mut attr), 0); - // Reserve room for the red zone, the runtime's stack of last resort. - let stack_size = cmp::max(stack, RED_ZONE + min_stack_size(&attr)); + let stack_size = cmp::max(stack, min_stack_size(&attr)); match pthread_attr_setstacksize(&mut attr, stack_size as libc::size_t) { 0 => {} n => { @@ -72,7 +70,6 @@ impl Thread { Ok(Thread { id: native }) }; - #[no_stack_check] extern fn thread_start(main: *mut libc::c_void) -> *mut libc::c_void { unsafe { start_thread(main); } 0 as *mut _ |
