about summary refs log tree commit diff
path: root/src/libstd/unstable
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2013-11-06 15:16:04 -0800
committerAlex Crichton <alex@alexcrichton.com>2013-11-11 10:40:34 -0800
commit7755ffd0131fa99ca5d58bdd5eab443b44d5a1ff (patch)
treec00e95dee93195cb7744c4a37ea1d4d438db9456 /src/libstd/unstable
parent4059b5c4b3b8a57a645982b0770d25f0283dfb06 (diff)
Remove #[fixed_stack_segment] and #[rust_stack]
These two attributes are no longer useful now that Rust has decided to leave
segmented stacks behind. It is assumed that the rust task's stack is always
large enough to make an FFI call (due to the stack being very large).

There's always the case of stack overflow, however, to consider. This does not
change the behavior of stack overflow in Rust. This is still normally triggered
by the __morestack function and aborts the whole process.

C stack overflow will continue to corrupt the stack, however (as it did before
this commit as well). The future improvement of a guard page at the end of every
rust stack is still unimplemented and is intended to be the mechanism through
which we attempt to detect C stack overflow.

Closes #8822
Closes #10155
Diffstat (limited to 'src/libstd/unstable')
-rw-r--r--src/libstd/unstable/dynamic_lib.rs14
-rw-r--r--src/libstd/unstable/intrinsics.rs12
-rw-r--r--src/libstd/unstable/mod.rs1
-rw-r--r--src/libstd/unstable/sync.rs14
4 files changed, 8 insertions, 33 deletions
diff --git a/src/libstd/unstable/dynamic_lib.rs b/src/libstd/unstable/dynamic_lib.rs
index d3c43e692a9..1ce228250c9 100644
--- a/src/libstd/unstable/dynamic_lib.rs
+++ b/src/libstd/unstable/dynamic_lib.rs
@@ -144,21 +144,16 @@ pub mod dl {
     use result::*;
 
     pub unsafe fn open_external(filename: &path::Path) -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
         do filename.with_c_str |raw_name| {
             dlopen(raw_name, Lazy as libc::c_int)
         }
     }
 
     pub unsafe fn open_internal() -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
-
         dlopen(ptr::null(), Lazy as libc::c_int)
     }
 
     pub fn check_for_errors_in<T>(f: &fn()->T) -> Result<T, ~str> {
-        #[fixed_stack_segment]; #[inline(never)];
-
         unsafe {
             // dlerror isn't thread safe, so we need to lock around this entire
             // sequence. `atomically` asserts that we don't do anything that
@@ -184,13 +179,9 @@ pub mod dl {
     }
 
     pub unsafe fn symbol(handle: *libc::c_void, symbol: *libc::c_char) -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
-
         dlsym(handle, symbol)
     }
     pub unsafe fn close(handle: *libc::c_void) {
-        #[fixed_stack_segment]; #[inline(never)];
-
         dlclose(handle); ()
     }
 
@@ -225,21 +216,18 @@ pub mod dl {
     use result::*;
 
     pub unsafe fn open_external(filename: &path::Path) -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
         do os::win32::as_utf16_p(filename.as_str().unwrap()) |raw_name| {
             LoadLibraryW(raw_name)
         }
     }
 
     pub unsafe fn open_internal() -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
         let handle = ptr::null();
         GetModuleHandleExW(0 as libc::DWORD, ptr::null(), &handle as **libc::c_void);
         handle
     }
 
     pub fn check_for_errors_in<T>(f: &fn()->T) -> Result<T, ~str> {
-        #[fixed_stack_segment]; #[inline(never)];
         unsafe {
             do atomically {
                 SetLastError(0);
@@ -257,11 +245,9 @@ pub mod dl {
     }
 
     pub unsafe fn symbol(handle: *libc::c_void, symbol: *libc::c_char) -> *libc::c_void {
-        #[fixed_stack_segment]; #[inline(never)];
         GetProcAddress(handle, symbol)
     }
     pub unsafe fn close(handle: *libc::c_void) {
-        #[fixed_stack_segment]; #[inline(never)];
         FreeLibrary(handle); ()
     }
 
diff --git a/src/libstd/unstable/intrinsics.rs b/src/libstd/unstable/intrinsics.rs
index 59d1740acc0..f0b94c10fdc 100644
--- a/src/libstd/unstable/intrinsics.rs
+++ b/src/libstd/unstable/intrinsics.rs
@@ -369,28 +369,16 @@ extern "rust-intrinsic" {
     pub fn powif32(a: f32, x: i32) -> f32;
     pub fn powif64(a: f64, x: i32) -> f64;
 
-    // the following kill the stack canary without
-    // `fixed_stack_segment`. This possibly only affects the f64
-    // variants, but it's hard to be sure since it seems to only
-    // occur with fairly specific arguments.
-    #[fixed_stack_segment]
     pub fn sinf32(x: f32) -> f32;
-    #[fixed_stack_segment]
     pub fn sinf64(x: f64) -> f64;
 
-    #[fixed_stack_segment]
     pub fn cosf32(x: f32) -> f32;
-    #[fixed_stack_segment]
     pub fn cosf64(x: f64) -> f64;
 
-    #[fixed_stack_segment]
     pub fn powf32(a: f32, x: f32) -> f32;
-    #[fixed_stack_segment]
     pub fn powf64(a: f64, x: f64) -> f64;
 
-    #[fixed_stack_segment]
     pub fn expf32(x: f32) -> f32;
-    #[fixed_stack_segment]
     pub fn expf64(x: f64) -> f64;
 
     pub fn exp2f32(x: f32) -> f32;
diff --git a/src/libstd/unstable/mod.rs b/src/libstd/unstable/mod.rs
index 484ddde6d3c..ea03ea6f551 100644
--- a/src/libstd/unstable/mod.rs
+++ b/src/libstd/unstable/mod.rs
@@ -72,7 +72,6 @@ fn test_run_in_bare_thread_exchange() {
 /// can't run correctly un-altered. Valgrind is there to help
 /// you notice weirdness in normal, un-doctored code paths!
 pub fn running_on_valgrind() -> bool {
-    #[fixed_stack_segment]; #[inline(never)];
     unsafe { rust_running_on_valgrind() != 0 }
 }
 
diff --git a/src/libstd/unstable/sync.rs b/src/libstd/unstable/sync.rs
index 1c412791d05..a08b914ca31 100644
--- a/src/libstd/unstable/sync.rs
+++ b/src/libstd/unstable/sync.rs
@@ -475,12 +475,14 @@ impl<T:Send> Exclusive<T> {
     }
 }
 
-externfn!(fn rust_create_little_lock() -> rust_little_lock)
-externfn!(fn rust_destroy_little_lock(lock: rust_little_lock))
-externfn!(fn rust_lock_little_lock(lock: rust_little_lock))
-externfn!(fn rust_unlock_little_lock(lock: rust_little_lock))
-externfn!(fn rust_signal_little_lock(lock: rust_little_lock))
-externfn!(fn rust_wait_little_lock(lock: rust_little_lock))
+extern {
+    fn rust_create_little_lock() -> rust_little_lock;
+    fn rust_destroy_little_lock(lock: rust_little_lock);
+    fn rust_lock_little_lock(lock: rust_little_lock);
+    fn rust_unlock_little_lock(lock: rust_little_lock);
+    fn rust_signal_little_lock(lock: rust_little_lock);
+    fn rust_wait_little_lock(lock: rust_little_lock);
+}
 
 #[cfg(test)]
 mod tests {