diff options
Diffstat (limited to 'src/libstd')
33 files changed, 41 insertions, 229 deletions
diff --git a/src/libstd/c_str.rs b/src/libstd/c_str.rs index 6166bbaaaa3..4d5c68ab717 100644 --- a/src/libstd/c_str.rs +++ b/src/libstd/c_str.rs @@ -40,7 +40,9 @@ An example of creating and using a C string would be: ```rust use std::libc; -externfn!(fn puts(s: *libc::c_char)) +extern { + fn puts(s: *libc::c_char); +} let my_string = "Hello, world!"; @@ -179,7 +181,6 @@ impl CString { impl Drop for CString { fn drop(&mut self) { - #[fixed_stack_segment]; #[inline(never)]; if self.owns_buffer_ { unsafe { libc::free(self.buf as *libc::c_void) @@ -260,7 +261,6 @@ static BUF_LEN: uint = 128; impl<'self> ToCStr for &'self [u8] { fn to_c_str(&self) -> CString { - #[fixed_stack_segment]; #[inline(never)]; let mut cs = unsafe { self.to_c_str_unchecked() }; do cs.with_mut_ref |buf| { check_for_null(*self, buf); @@ -269,7 +269,6 @@ impl<'self> ToCStr for &'self [u8] { } unsafe fn to_c_str_unchecked(&self) -> CString { - #[fixed_stack_segment]; #[inline(never)]; do self.as_imm_buf |self_buf, self_len| { let buf = libc::malloc(self_len as libc::size_t + 1) as *mut u8; if buf.is_null() { @@ -460,16 +459,12 @@ mod tests { #[test] fn test_unwrap() { - #[fixed_stack_segment]; #[inline(never)]; - let c_str = "hello".to_c_str(); unsafe { libc::free(c_str.unwrap() as *libc::c_void) } } #[test] fn test_with_ref() { - #[fixed_stack_segment]; #[inline(never)]; - let c_str = "hello".to_c_str(); let len = unsafe { c_str.with_ref(|buf| libc::strlen(buf)) }; assert!(!c_str.is_null()); diff --git a/src/libstd/lib.rs b/src/libstd/lib.rs index 008f9b27a12..967aee9135d 100644 --- a/src/libstd/lib.rs +++ b/src/libstd/lib.rs @@ -64,6 +64,8 @@ #[deny(non_camel_case_types)]; #[deny(missing_doc)]; +#[allow(unrecognized_lint)]; // NOTE: remove after the next snapshot +#[allow(cstack)]; // NOTE: remove after the next snapshot. // When testing libstd, bring in libuv as the I/O backend so tests can print // things and all of the std::rt::io tests have an I/O interface to run on top diff --git a/src/libstd/libc.rs b/src/libstd/libc.rs index e68018e6b51..190f6a7c86f 100644 --- a/src/libstd/libc.rs +++ b/src/libstd/libc.rs @@ -2857,11 +2857,7 @@ pub mod funcs { // These are fine to execute on the Rust stack. They must be, // in fact, because LLVM generates calls to them! - #[rust_stack] - #[inline] pub fn memcmp(cx: *c_void, ct: *c_void, n: size_t) -> c_int; - #[rust_stack] - #[inline] pub fn memchr(cx: *c_void, c: c_int, n: size_t) -> *c_void; } } @@ -3059,11 +3055,9 @@ pub mod funcs { // doesn't link it correctly on i686, so we're going // through a C function that mysteriously does work. pub unsafe fn opendir(dirname: *c_char) -> *DIR { - #[fixed_stack_segment]; #[inline(never)]; rust_opendir(dirname) } pub unsafe fn readdir(dirp: *DIR) -> *dirent_t { - #[fixed_stack_segment]; #[inline(never)]; rust_readdir(dirp) } diff --git a/src/libstd/local_data.rs b/src/libstd/local_data.rs index 30175d6609b..684fb9c76d9 100644 --- a/src/libstd/local_data.rs +++ b/src/libstd/local_data.rs @@ -277,7 +277,6 @@ fn get_with<T: 'static, U>(key: Key<T>, } fn abort() -> ! { - #[fixed_stack_segment]; #[inline(never)]; unsafe { libc::abort() } } diff --git a/src/libstd/num/f32.rs b/src/libstd/num/f32.rs index d6de4f25f6e..a0dddffd851 100644 --- a/src/libstd/num/f32.rs +++ b/src/libstd/num/f32.rs @@ -41,7 +41,7 @@ macro_rules! delegate( use unstable::intrinsics; $( - #[inline] #[fixed_stack_segment] #[inline(never)] + #[inline] pub fn $name($( $arg : $arg_ty ),*) -> $rv { unsafe { $bound_name($( $arg ),*) diff --git a/src/libstd/num/f64.rs b/src/libstd/num/f64.rs index 5feab20ba81..8cb7fa18001 100644 --- a/src/libstd/num/f64.rs +++ b/src/libstd/num/f64.rs @@ -43,7 +43,7 @@ macro_rules! delegate( use unstable::intrinsics; $( - #[inline] #[fixed_stack_segment] #[inline(never)] + #[inline] pub fn $name($( $arg : $arg_ty ),*) -> $rv { unsafe { $bound_name($( $arg ),*) diff --git a/src/libstd/os.rs b/src/libstd/os.rs index de4fb54be95..ff24c35d4e6 100644 --- a/src/libstd/os.rs +++ b/src/libstd/os.rs @@ -47,7 +47,6 @@ pub use os::consts::*; /// Delegates to the libc close() function, returning the same return value. pub fn close(fd: c_int) -> c_int { - #[fixed_stack_segment]; #[inline(never)]; unsafe { libc::close(fd) } @@ -58,7 +57,6 @@ static BUF_BYTES : uint = 2048u; #[cfg(unix)] pub fn getcwd() -> Path { - #[fixed_stack_segment]; #[inline(never)]; let mut buf = [0 as libc::c_char, ..BUF_BYTES]; do buf.as_mut_buf |buf, len| { unsafe { @@ -73,7 +71,6 @@ pub fn getcwd() -> Path { #[cfg(windows)] pub fn getcwd() -> Path { - #[fixed_stack_segment]; #[inline(never)]; use libc::DWORD; use libc::GetCurrentDirectoryW; let mut buf = [0 as u16, ..BUF_BYTES]; @@ -99,7 +96,6 @@ pub mod win32 { pub fn fill_utf16_buf_and_decode(f: &fn(*mut u16, DWORD) -> DWORD) -> Option<~str> { - #[fixed_stack_segment]; #[inline(never)]; unsafe { let mut n = TMPBUF_SZ as DWORD; @@ -153,8 +149,10 @@ fn with_env_lock<T>(f: &fn() -> T) -> T { }; } - externfn!(fn rust_take_env_lock()); - externfn!(fn rust_drop_env_lock()); + extern { + fn rust_take_env_lock(); + fn rust_drop_env_lock(); + } } /// Returns a vector of (variable, value) pairs for all the environment @@ -163,7 +161,6 @@ pub fn env() -> ~[(~str,~str)] { unsafe { #[cfg(windows)] unsafe fn get_env_pairs() -> ~[~str] { - #[fixed_stack_segment]; #[inline(never)]; use c_str; use str::StrSlice; @@ -185,8 +182,6 @@ pub fn env() -> ~[(~str,~str)] { } #[cfg(unix)] unsafe fn get_env_pairs() -> ~[~str] { - #[fixed_stack_segment]; #[inline(never)]; - extern { fn rust_env_pairs() -> **libc::c_char; } @@ -225,7 +220,6 @@ pub fn env() -> ~[(~str,~str)] { /// Fetches the environment variable `n` from the current process, returning /// None if the variable isn't set. pub fn getenv(n: &str) -> Option<~str> { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do with_env_lock { let s = do n.with_c_str |buf| { @@ -244,8 +238,6 @@ pub fn getenv(n: &str) -> Option<~str> { /// Fetches the environment variable `n` from the current process, returning /// None if the variable isn't set. pub fn getenv(n: &str) -> Option<~str> { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { do with_env_lock { use os::win32::{as_utf16_p, fill_utf16_buf_and_decode}; @@ -263,7 +255,6 @@ pub fn getenv(n: &str) -> Option<~str> { /// Sets the environment variable `n` to the value `v` for the currently running /// process pub fn setenv(n: &str, v: &str) { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do with_env_lock { do n.with_c_str |nbuf| { @@ -280,8 +271,6 @@ pub fn setenv(n: &str, v: &str) { /// Sets the environment variable `n` to the value `v` for the currently running /// process pub fn setenv(n: &str, v: &str) { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { do with_env_lock { use os::win32::as_utf16_p; @@ -298,7 +287,6 @@ pub fn setenv(n: &str, v: &str) { pub fn unsetenv(n: &str) { #[cfg(unix)] fn _unsetenv(n: &str) { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do with_env_lock { do n.with_c_str |nbuf| { @@ -309,7 +297,6 @@ pub fn unsetenv(n: &str) { } #[cfg(windows)] fn _unsetenv(n: &str) { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do with_env_lock { use os::win32::as_utf16_p; @@ -330,7 +317,6 @@ pub struct Pipe { #[cfg(unix)] pub fn pipe() -> Pipe { - #[fixed_stack_segment]; #[inline(never)]; unsafe { let mut fds = Pipe {input: 0 as c_int, out: 0 as c_int }; @@ -341,7 +327,6 @@ pub fn pipe() -> Pipe { #[cfg(windows)] pub fn pipe() -> Pipe { - #[fixed_stack_segment]; #[inline(never)]; unsafe { // Windows pipes work subtly differently than unix pipes, and their // inheritance has to be handled in a different way that I do not @@ -360,7 +345,6 @@ pub fn pipe() -> Pipe { } fn dup2(src: c_int, dst: c_int) -> c_int { - #[fixed_stack_segment]; #[inline(never)]; unsafe { libc::dup2(src, dst) } @@ -377,7 +361,6 @@ pub fn self_exe_path() -> Option<Path> { #[cfg(target_os = "freebsd")] fn load_self() -> Option<~[u8]> { - #[fixed_stack_segment]; #[inline(never)]; unsafe { use libc::funcs::bsd44::*; use libc::consts::os::extra::*; @@ -415,7 +398,6 @@ pub fn self_exe_path() -> Option<Path> { #[cfg(target_os = "macos")] fn load_self() -> Option<~[u8]> { - #[fixed_stack_segment]; #[inline(never)]; unsafe { use libc::funcs::extra::_NSGetExecutablePath; use vec; @@ -434,7 +416,6 @@ pub fn self_exe_path() -> Option<Path> { #[cfg(windows)] fn load_self() -> Option<~[u8]> { - #[fixed_stack_segment]; #[inline(never)]; unsafe { use os::win32::fill_utf16_buf_and_decode; do fill_utf16_buf_and_decode() |buf, sz| { @@ -555,7 +536,6 @@ pub fn change_dir(p: &Path) -> bool { #[cfg(windows)] fn chdir(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { use os::win32::as_utf16_p; return do as_utf16_p(p.as_str().unwrap()) |buf| { @@ -566,7 +546,6 @@ pub fn change_dir(p: &Path) -> bool { #[cfg(unix)] fn chdir(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; do p.with_c_str |buf| { unsafe { libc::chdir(buf) == (0 as c_int) @@ -581,7 +560,6 @@ pub fn errno() -> int { #[cfg(target_os = "macos")] #[cfg(target_os = "freebsd")] fn errno_location() -> *c_int { - #[fixed_stack_segment]; #[inline(never)]; #[nolink] extern { fn __error() -> *c_int; @@ -594,7 +572,6 @@ pub fn errno() -> int { #[cfg(target_os = "linux")] #[cfg(target_os = "android")] fn errno_location() -> *c_int { - #[fixed_stack_segment]; #[inline(never)]; #[nolink] extern { fn __errno_location() -> *c_int; @@ -612,7 +589,6 @@ pub fn errno() -> int { #[cfg(windows)] /// Returns the platform-specific value of errno pub fn errno() -> uint { - #[fixed_stack_segment]; #[inline(never)]; use libc::types::os::arch::extra::DWORD; #[link_name = "kernel32"] @@ -634,8 +610,6 @@ pub fn last_os_error() -> ~str { #[cfg(target_os = "freebsd")] fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int { - #[fixed_stack_segment]; #[inline(never)]; - #[nolink] extern { fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) @@ -651,7 +625,6 @@ pub fn last_os_error() -> ~str { // So we just use __xpg_strerror_r which is always POSIX compliant #[cfg(target_os = "linux")] fn strerror_r(errnum: c_int, buf: *mut c_char, buflen: size_t) -> c_int { - #[fixed_stack_segment]; #[inline(never)]; #[nolink] extern { fn __xpg_strerror_r(errnum: c_int, @@ -679,8 +652,6 @@ pub fn last_os_error() -> ~str { #[cfg(windows)] fn strerror() -> ~str { - #[fixed_stack_segment]; #[inline(never)]; - use libc::types::os::arch::extra::DWORD; use libc::types::os::arch::extra::LPWSTR; use libc::types::os::arch::extra::LPVOID; @@ -758,8 +729,6 @@ unsafe fn load_argc_and_argv(argc: c_int, argv: **c_char) -> ~[~str] { */ #[cfg(target_os = "macos")] fn real_args() -> ~[~str] { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { let (argc, argv) = (*_NSGetArgc() as c_int, *_NSGetArgv() as **c_char); @@ -781,7 +750,6 @@ fn real_args() -> ~[~str] { #[cfg(windows)] fn real_args() -> ~[~str] { - #[fixed_stack_segment]; #[inline(never)]; use vec; let mut nArgs: c_int = 0; @@ -858,8 +826,6 @@ fn round_up(from: uint, to: uint) -> uint { #[cfg(unix)] pub fn page_size() -> uint { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { libc::sysconf(libc::_SC_PAGESIZE) as uint } @@ -867,8 +833,6 @@ pub fn page_size() -> uint { #[cfg(windows)] pub fn page_size() -> uint { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { let mut info = libc::SYSTEM_INFO::new(); libc::GetSystemInfo(&mut info); @@ -979,8 +943,6 @@ impl to_str::ToStr for MapError { impl MemoryMap { /// Create a new mapping with the given `options`, at least `min_len` bytes long. pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError> { - #[fixed_stack_segment]; #[inline(never)]; - use libc::off_t; let mut addr: *c_void = ptr::null(); @@ -1043,8 +1005,6 @@ impl MemoryMap { impl Drop for MemoryMap { /// Unmap the mapping. Fails the task if `munmap` fails. fn drop(&mut self) { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { match libc::munmap(self.data as *c_void, self.len) { 0 => (), @@ -1062,8 +1022,6 @@ impl Drop for MemoryMap { impl MemoryMap { /// Create a new mapping with the given `options`, at least `min_len` bytes long. pub fn new(min_len: uint, options: &[MapOption]) -> Result<MemoryMap, MapError> { - #[fixed_stack_segment]; #[inline(never)]; - use libc::types::os::arch::extra::{LPVOID, DWORD, SIZE_T, HANDLE}; let mut lpAddress: LPVOID = ptr::mut_null(); @@ -1156,8 +1114,6 @@ impl MemoryMap { /// Granularity of MapAddr() and MapOffset() parameter values. /// This may be greater than the value returned by page_size(). pub fn granularity() -> uint { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { let mut info = libc::SYSTEM_INFO::new(); libc::GetSystemInfo(&mut info); @@ -1172,8 +1128,6 @@ impl Drop for MemoryMap { /// Unmap the mapping. Fails the task if any of `VirtualFree`, `UnmapViewOfFile`, or /// `CloseHandle` fail. fn drop(&mut self) { - #[fixed_stack_segment]; #[inline(never)]; - use libc::types::os::arch::extra::{LPCVOID, HANDLE}; use libc::consts::os::extra::FALSE; @@ -1490,8 +1444,6 @@ mod tests { #[test] fn memory_map_file() { - #[fixed_stack_segment]; #[inline(never)]; - use result::{Ok, Err}; use os::*; use libc::*; @@ -1499,16 +1451,12 @@ mod tests { use rt::io::fs; #[cfg(unix)] - #[fixed_stack_segment] - #[inline(never)] fn lseek_(fd: c_int, size: uint) { unsafe { assert!(lseek(fd, size as off_t, SEEK_SET) == size as off_t); } } #[cfg(windows)] - #[fixed_stack_segment] - #[inline(never)] fn lseek_(fd: c_int, size: uint) { unsafe { assert!(lseek(fd, size as c_long, SEEK_SET) == size as c_long); diff --git a/src/libstd/rand/os.rs b/src/libstd/rand/os.rs index a6d05ea307c..73d5c72a728 100644 --- a/src/libstd/rand/os.rs +++ b/src/libstd/rand/os.rs @@ -71,7 +71,7 @@ impl OSRng { /// Create a new `OSRng`. #[cfg(windows)] pub fn new() -> OSRng { - externfn!(fn rust_win32_rand_acquire(phProv: *mut HCRYPTPROV)) + extern { fn rust_win32_rand_acquire(phProv: *mut HCRYPTPROV); } let mut hcp = 0; unsafe {rust_win32_rand_acquire(&mut hcp)}; @@ -106,7 +106,10 @@ impl Rng for OSRng { unsafe { cast::transmute(v) } } fn fill_bytes(&mut self, v: &mut [u8]) { - externfn!(fn rust_win32_rand_gen(hProv: HCRYPTPROV, dwLen: DWORD, pbBuffer: *mut BYTE)) + extern { + fn rust_win32_rand_gen(hProv: HCRYPTPROV, dwLen: DWORD, + pbBuffer: *mut BYTE); + } do v.as_mut_buf |ptr, len| { unsafe {rust_win32_rand_gen(self.hcryptprov, len as DWORD, ptr)} @@ -123,7 +126,7 @@ impl Drop for OSRng { #[cfg(windows)] fn drop(&mut self) { - externfn!(fn rust_win32_rand_release(hProv: HCRYPTPROV)) + extern { fn rust_win32_rand_release(hProv: HCRYPTPROV); } unsafe {rust_win32_rand_release(self.hcryptprov)} } diff --git a/src/libstd/rt/args.rs b/src/libstd/rt/args.rs index 24143ba040b..48e58879026 100644 --- a/src/libstd/rt/args.rs +++ b/src/libstd/rt/args.rs @@ -117,9 +117,11 @@ mod imp { } } - externfn!(fn rust_take_global_args_lock()) - externfn!(fn rust_drop_global_args_lock()) - externfn!(fn rust_get_global_args_ptr() -> *mut Option<~~[~str]>) + extern { + fn rust_take_global_args_lock(); + fn rust_drop_global_args_lock(); + fn rust_get_global_args_ptr() -> *mut Option<~~[~str]>; + } #[cfg(test)] mod tests { diff --git a/src/libstd/rt/basic.rs b/src/libstd/rt/basic.rs index 322c58bc2b8..a8f762c4c8f 100644 --- a/src/libstd/rt/basic.rs +++ b/src/libstd/rt/basic.rs @@ -236,7 +236,6 @@ impl Drop for BasicPausible { } fn time() -> Time { - #[fixed_stack_segment]; #[inline(never)]; extern { fn get_time(sec: &mut i64, nsec: &mut i32); } diff --git a/src/libstd/rt/context.rs b/src/libstd/rt/context.rs index b86dbfd6fb0..fcc30ded954 100644 --- a/src/libstd/rt/context.rs +++ b/src/libstd/rt/context.rs @@ -119,7 +119,6 @@ impl Context { } extern { - #[rust_stack] fn swap_registers(out_regs: *mut Registers, in_regs: *Registers); } @@ -376,7 +375,6 @@ pub unsafe fn record_sp_limit(limit: uint) { unsafe fn target_record_sp_limit(limit: uint) { return record_sp_limit(limit as *c_void); extern { - #[rust_stack] fn record_sp_limit(limit: *c_void); } } @@ -450,7 +448,6 @@ pub unsafe fn get_sp_limit() -> uint { unsafe fn target_get_sp_limit() -> uint { return get_sp_limit() as uint; extern { - #[rust_stack] fn get_sp_limit() -> *c_void; } } diff --git a/src/libstd/rt/crate_map.rs b/src/libstd/rt/crate_map.rs index a7a5b0084a2..8decaea1f47 100644 --- a/src/libstd/rt/crate_map.rs +++ b/src/libstd/rt/crate_map.rs @@ -49,8 +49,6 @@ pub fn get_crate_map() -> Option<&'static CrateMap<'static>> { } #[cfg(windows)] -#[fixed_stack_segment] -#[inline(never)] pub fn get_crate_map() -> Option<&'static CrateMap<'static>> { use cast::transmute; use c_str::ToCStr; diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs index 4964db8f1c1..c6e2724b0f2 100644 --- a/src/libstd/rt/global_heap.rs +++ b/src/libstd/rt/global_heap.rs @@ -14,7 +14,6 @@ use unstable::raw; use mem::size_of; extern { - #[rust_stack] fn abort(); } @@ -36,8 +35,6 @@ fn align_to(size: uint, align: uint) -> uint { /// A wrapper around libc::malloc, aborting on out-of-memory pub unsafe fn malloc_raw(size: uint) -> *c_void { - #[fixed_stack_segment]; #[inline(never)]; - let p = malloc(size as size_t); if p.is_null() { // we need a non-allocating way to print an error here @@ -48,8 +45,6 @@ pub unsafe fn malloc_raw(size: uint) -> *c_void { /// A wrapper around libc::realloc, aborting on out-of-memory pub unsafe fn realloc_raw(ptr: *mut c_void, size: uint) -> *mut c_void { - #[fixed_stack_segment]; #[inline(never)]; - let p = realloc(ptr, size as size_t); if p.is_null() { // we need a non-allocating way to print an error here @@ -100,8 +95,6 @@ pub unsafe fn exchange_free_(ptr: *c_char) { } pub unsafe fn exchange_free(ptr: *c_char) { - #[fixed_stack_segment]; #[inline(never)]; - free(ptr as *c_void); } diff --git a/src/libstd/rt/io/native/file.rs b/src/libstd/rt/io/native/file.rs index 6d4f29182dd..69d1159bf91 100644 --- a/src/libstd/rt/io/native/file.rs +++ b/src/libstd/rt/io/native/file.rs @@ -98,7 +98,6 @@ impl FileDesc { } impl Reader for FileDesc { - #[fixed_stack_segment] #[inline(never)] fn read(&mut self, buf: &mut [u8]) -> Option<uint> { #[cfg(windows)] type rlen = libc::c_uint; #[cfg(not(windows))] type rlen = libc::size_t; @@ -121,7 +120,6 @@ impl Reader for FileDesc { } impl Writer for FileDesc { - #[fixed_stack_segment] #[inline(never)] fn write(&mut self, buf: &[u8]) { #[cfg(windows)] type wlen = libc::c_uint; #[cfg(not(windows))] type wlen = libc::size_t; @@ -137,7 +135,6 @@ impl Writer for FileDesc { } impl Drop for FileDesc { - #[fixed_stack_segment] #[inline(never)] fn drop(&mut self) { if self.close_on_drop { unsafe { libc::close(self.fd); } @@ -158,7 +155,6 @@ impl CFile { } impl Reader for CFile { - #[fixed_stack_segment] #[inline(never)] fn read(&mut self, buf: &mut [u8]) -> Option<uint> { let ret = do keep_going(buf) |buf, len| { unsafe { @@ -176,14 +172,12 @@ impl Reader for CFile { } } - #[fixed_stack_segment] #[inline(never)] fn eof(&mut self) -> bool { unsafe { libc::feof(self.file) != 0 } } } impl Writer for CFile { - #[fixed_stack_segment] #[inline(never)] fn write(&mut self, buf: &[u8]) { let ret = do keep_going(buf) |buf, len| { unsafe { @@ -196,7 +190,6 @@ impl Writer for CFile { } } - #[fixed_stack_segment] #[inline(never)] fn flush(&mut self) { if unsafe { libc::fflush(self.file) } < 0 { raise_error(); @@ -205,7 +198,6 @@ impl Writer for CFile { } impl Seek for CFile { - #[fixed_stack_segment] #[inline(never)] fn tell(&self) -> u64 { let ret = unsafe { libc::ftell(self.file) }; if ret < 0 { @@ -214,7 +206,6 @@ impl Seek for CFile { return ret as u64; } - #[fixed_stack_segment] #[inline(never)] fn seek(&mut self, pos: i64, style: SeekStyle) { let whence = match style { SeekSet => libc::SEEK_SET, @@ -228,7 +219,6 @@ impl Seek for CFile { } impl Drop for CFile { - #[fixed_stack_segment] #[inline(never)] fn drop(&mut self) { unsafe { libc::fclose(self.file); } } @@ -242,7 +232,6 @@ mod tests { use rt::io::{io_error, SeekSet}; use super::*; - #[test] #[fixed_stack_segment] #[ignore(cfg(target_os = "freebsd"))] // hmm, maybe pipes have a tiny buffer fn test_file_desc() { // Run this test with some pipes so we don't have to mess around with @@ -278,7 +267,6 @@ mod tests { } } - #[test] #[fixed_stack_segment] #[ignore(cfg(windows))] // apparently windows doesn't like tmpfile fn test_cfile() { unsafe { @@ -358,7 +346,6 @@ mod old_os { #[cfg(unix)] /// Indicates whether a path represents a directory pub fn path_is_dir(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do p.with_c_str |buf| { rustrt::rust_path_is_dir(buf) != 0 as c_int @@ -369,7 +356,6 @@ mod old_os { #[cfg(windows)] pub fn path_is_dir(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do os::win32::as_utf16_p(p.as_str().unwrap()) |buf| { rustrt::rust_path_is_dir_u16(buf) != 0 as c_int @@ -380,7 +366,6 @@ mod old_os { #[cfg(unix)] /// Indicates whether a path exists pub fn path_exists(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do p.with_c_str |buf| { rustrt::rust_path_exists(buf) != 0 as c_int @@ -390,7 +375,6 @@ mod old_os { #[cfg(windows)] pub fn path_exists(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do os::win32::as_utf16_p(p.as_str().unwrap()) |buf| { rustrt::rust_path_exists_u16(buf) != 0 as c_int @@ -404,7 +388,6 @@ mod old_os { #[cfg(windows)] fn mkdir(p: &Path, _mode: c_int) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { use os::win32::as_utf16_p; // FIXME: turn mode into something useful? #2623 @@ -417,7 +400,6 @@ mod old_os { #[cfg(unix)] fn mkdir(p: &Path, mode: c_int) -> bool { - #[fixed_stack_segment]; #[inline(never)]; do p.with_c_str |buf| { unsafe { libc::mkdir(buf, mode as libc::mode_t) == (0 as c_int) @@ -457,7 +439,6 @@ mod old_os { #[cfg(target_os = "freebsd")] #[cfg(target_os = "macos")] unsafe fn get_list(p: &Path) -> ~[Path] { - #[fixed_stack_segment]; #[inline(never)]; use libc::{dirent_t}; use libc::{opendir, readdir, closedir}; extern { @@ -488,7 +469,6 @@ mod old_os { } #[cfg(windows)] unsafe fn get_list(p: &Path) -> ~[Path] { - #[fixed_stack_segment]; #[inline(never)]; use libc::consts::os::extra::INVALID_HANDLE_VALUE; use libc::{wcslen, free}; use libc::funcs::extra::kernel32::{ @@ -568,7 +548,6 @@ mod old_os { #[cfg(windows)] fn rmdir(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { use os::win32::as_utf16_p; return do as_utf16_p(p.as_str().unwrap()) |buf| { @@ -579,7 +558,6 @@ mod old_os { #[cfg(unix)] fn rmdir(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; do p.with_c_str |buf| { unsafe { libc::rmdir(buf) == (0 as c_int) @@ -594,7 +572,6 @@ mod old_os { #[cfg(windows)] fn unlink(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { use os::win32::as_utf16_p; return do as_utf16_p(p.as_str().unwrap()) |buf| { @@ -605,7 +582,6 @@ mod old_os { #[cfg(unix)] fn unlink(p: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do p.with_c_str |buf| { libc::unlink(buf) == (0 as c_int) @@ -616,7 +592,6 @@ mod old_os { /// Renames an existing file or directory pub fn rename_file(old: &Path, new: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { do old.with_c_str |old_buf| { do new.with_c_str |new_buf| { @@ -632,7 +607,6 @@ mod old_os { #[cfg(windows)] fn do_copy_file(from: &Path, to: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { use os::win32::as_utf16_p; return do as_utf16_p(from.as_str().unwrap()) |fromp| { @@ -646,7 +620,6 @@ mod old_os { #[cfg(unix)] fn do_copy_file(from: &Path, to: &Path) -> bool { - #[fixed_stack_segment]; #[inline(never)]; unsafe { let istream = do from.with_c_str |fromp| { do "rb".with_c_str |modebuf| { diff --git a/src/libstd/rt/io/native/process.rs b/src/libstd/rt/io/native/process.rs index f5c39de1bf4..9bf0ed63e8c 100644 --- a/src/libstd/rt/io/native/process.rs +++ b/src/libstd/rt/io/native/process.rs @@ -69,8 +69,6 @@ impl Process { stdin: Option<file::fd_t>, stdout: Option<file::fd_t>, stderr: Option<file::fd_t>) -> Process { - #[fixed_stack_segment]; #[inline(never)]; - let (in_pipe, in_fd) = match stdin { None => { let pipe = os::pipe(); @@ -208,7 +206,6 @@ impl Process { #[cfg(windows)] unsafe fn killpid(pid: pid_t, signal: int) -> Result<(), io::IoError> { - #[fixed_stack_segment]; #[inline(never)]; match signal { io::process::PleaseExitSignal | io::process::MustDieSignal => { @@ -226,7 +223,6 @@ impl Process { #[cfg(not(windows))] unsafe fn killpid(pid: pid_t, signal: int) -> Result<(), io::IoError> { - #[fixed_stack_segment]; #[inline(never)]; libc::funcs::posix88::signal::kill(pid, signal as c_int); Ok(()) } @@ -254,8 +250,6 @@ fn spawn_process_os(prog: &str, args: &[~str], env: Option<~[(~str, ~str)]>, dir: Option<&Path>, in_fd: c_int, out_fd: c_int, err_fd: c_int) -> SpawnProcessResult { - #[fixed_stack_segment]; #[inline(never)]; - use libc::types::os::arch::extra::{DWORD, HANDLE, STARTUPINFO}; use libc::consts::os::extra::{ TRUE, FALSE, @@ -439,8 +433,6 @@ fn spawn_process_os(prog: &str, args: &[~str], env: Option<~[(~str, ~str)]>, dir: Option<&Path>, in_fd: c_int, out_fd: c_int, err_fd: c_int) -> SpawnProcessResult { - #[fixed_stack_segment]; #[inline(never)]; - use libc::funcs::posix88::unistd::{fork, dup2, close, chdir, execvp}; use libc::funcs::bsd44::getdtablesize; @@ -455,7 +447,7 @@ fn spawn_process_os(prog: &str, args: &[~str], unsafe fn set_environ(_envp: *c_void) {} #[cfg(target_os = "macos")] unsafe fn set_environ(envp: *c_void) { - externfn!(fn _NSGetEnviron() -> *mut *c_void); + extern { fn _NSGetEnviron() -> *mut *c_void; } *_NSGetEnviron() = envp; } @@ -603,7 +595,6 @@ fn with_dirp<T>(d: Option<&Path>, cb: &fn(*libc::c_char) -> T) -> T { #[cfg(windows)] fn free_handle(handle: *()) { - #[fixed_stack_segment]; #[inline(never)]; unsafe { libc::funcs::extra::kernel32::CloseHandle(cast::transmute(handle)); } @@ -629,8 +620,6 @@ fn waitpid(pid: pid_t) -> int { #[cfg(windows)] fn waitpid_os(pid: pid_t) -> int { - #[fixed_stack_segment]; #[inline(never)]; - use libc::types::os::arch::extra::DWORD; use libc::consts::os::extra::{ SYNCHRONIZE, @@ -676,8 +665,6 @@ fn waitpid(pid: pid_t) -> int { #[cfg(unix)] fn waitpid_os(pid: pid_t) -> int { - #[fixed_stack_segment]; #[inline(never)]; - use libc::funcs::posix01::wait::*; #[cfg(target_os = "linux")] diff --git a/src/libstd/rt/io/signal.rs b/src/libstd/rt/io/signal.rs index 9fe8cb3ed90..3f013d5cac9 100644 --- a/src/libstd/rt/io/signal.rs +++ b/src/libstd/rt/io/signal.rs @@ -154,7 +154,6 @@ mod test { // kill is only available on Unixes #[cfg(unix)] - #[fixed_stack_segment] fn sigint() { unsafe { libc::funcs::posix88::signal::kill(libc::getpid(), libc::SIGINT); diff --git a/src/libstd/rt/io/stdio.rs b/src/libstd/rt/io/stdio.rs index acc2e11f067..e829c77cec1 100644 --- a/src/libstd/rt/io/stdio.rs +++ b/src/libstd/rt/io/stdio.rs @@ -69,7 +69,6 @@ enum StdSource { File(~RtioFileStream), } -#[fixed_stack_segment] #[inline(never)] fn src<T>(fd: libc::c_int, readable: bool, f: &fn(StdSource) -> T) -> T { do with_local_io |io| { let fd = unsafe { libc::dup(fd) }; @@ -91,7 +90,6 @@ fn src<T>(fd: libc::c_int, readable: bool, f: &fn(StdSource) -> T) -> T { /// Creates a new non-blocking handle to the stdin of the current process. /// /// See `stdout()` for notes about this function. -#[fixed_stack_segment] #[inline(never)] pub fn stdin() -> StdReader { do src(libc::STDIN_FILENO, true) |src| { StdReader { inner: src } } } diff --git a/src/libstd/rt/local_ptr.rs b/src/libstd/rt/local_ptr.rs index c9534413c53..f35b657d9dd 100644 --- a/src/libstd/rt/local_ptr.rs +++ b/src/libstd/rt/local_ptr.rs @@ -26,8 +26,6 @@ use tls = rt::thread_local_storage; static mut RT_TLS_KEY: tls::Key = -1; /// Initialize the TLS key. Other ops will fail if this isn't executed first. -#[fixed_stack_segment] -#[inline(never)] pub fn init_tls_key() { unsafe { rust_initialize_rt_tls_key(&mut RT_TLS_KEY); diff --git a/src/libstd/rt/logging.rs b/src/libstd/rt/logging.rs index c37195a7b15..f346380ff7a 100644 --- a/src/libstd/rt/logging.rs +++ b/src/libstd/rt/logging.rs @@ -135,7 +135,6 @@ fn update_entry(dirs: &[LogDirective], entry: &ModEntry) -> u32 { if longest_match >= 0 { return 1; } else { return 0; } } -#[fixed_stack_segment] #[inline(never)] /// Set log level for every entry in crate_map according to the sepecification /// in settings fn update_log_settings(crate_map: &CrateMap, settings: ~str) { diff --git a/src/libstd/rt/mod.rs b/src/libstd/rt/mod.rs index a5c0d3be044..f18b4dc4234 100644 --- a/src/libstd/rt/mod.rs +++ b/src/libstd/rt/mod.rs @@ -463,8 +463,6 @@ pub fn in_green_task_context() -> bool { } pub fn new_event_loop() -> ~rtio::EventLoop { - #[fixed_stack_segment]; #[allow(cstack)]; - match crate_map::get_crate_map() { None => {} Some(map) => { diff --git a/src/libstd/rt/sched.rs b/src/libstd/rt/sched.rs index c2e665f4903..f4e5811acd3 100644 --- a/src/libstd/rt/sched.rs +++ b/src/libstd/rt/sched.rs @@ -853,7 +853,6 @@ fn new_sched_rng() -> XorShiftRng { XorShiftRng::new() } #[cfg(unix)] -#[fixed_stack_segment] #[inline(never)] fn new_sched_rng() -> XorShiftRng { use libc; use mem; diff --git a/src/libstd/rt/stack.rs b/src/libstd/rt/stack.rs index 55bd4b0732a..4358390da9f 100644 --- a/src/libstd/rt/stack.rs +++ b/src/libstd/rt/stack.rs @@ -21,8 +21,6 @@ pub struct StackSegment { impl StackSegment { pub fn new(size: uint) -> StackSegment { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { // Crate a block of uninitialized values let mut stack = vec::with_capacity(size); @@ -54,8 +52,6 @@ impl StackSegment { impl Drop for StackSegment { fn drop(&mut self) { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { // XXX: Using the FFI to call a C macro. Slow rust_valgrind_stack_deregister(self.valgrind_id); diff --git a/src/libstd/rt/task.rs b/src/libstd/rt/task.rs index 7e374fc6021..7620a4371c1 100644 --- a/src/libstd/rt/task.rs +++ b/src/libstd/rt/task.rs @@ -509,7 +509,6 @@ impl Unwinder { } extern { - #[rust_stack] fn rust_try(f: extern "C" fn(*c_void, *c_void), code: *c_void, data: *c_void) -> uintptr_t; @@ -517,8 +516,6 @@ impl Unwinder { } pub fn begin_unwind(&mut self, cause: ~Any) -> ! { - #[fixed_stack_segment]; #[inline(never)]; - self.unwinding = true; self.cause = Some(cause); unsafe { @@ -537,9 +534,8 @@ impl Unwinder { /// truly consider it to be stack overflow rather than allocating a new stack. #[no_mangle] // - this is called from C code #[no_split_stack] // - it would be sad for this function to trigger __morestack -#[doc(hidden)] // XXX: this function shouldn't have to be `pub` to get exported - // so it can be linked against, we should have a better way - // of specifying that. +#[doc(hidden)] // - Function must be `pub` to get exported, but it's + // irrelevant for documentation purposes. pub extern "C" fn rust_stack_exhausted() { use rt::in_green_task_context; use rt::task::Task; diff --git a/src/libstd/rt/test.rs b/src/libstd/rt/test.rs index aa680cddf2a..3db9c049eb2 100644 --- a/src/libstd/rt/test.rs +++ b/src/libstd/rt/test.rs @@ -143,8 +143,6 @@ mod darwin_fd_limit { static RLIMIT_NOFILE: libc::c_int = 8; pub unsafe fn raise_fd_limit() { - #[fixed_stack_segment]; #[inline(never)]; - // The strategy here is to fetch the current resource limits, read the kern.maxfilesperproc // sysctl value, and bump the soft resource limit for maxfiles up to the sysctl value. use ptr::{to_unsafe_ptr, to_mut_unsafe_ptr, mut_null}; @@ -362,7 +360,6 @@ pub fn cleanup_task(mut task: ~Task) { } /// Get a port number, starting at 9600, for use in tests -#[fixed_stack_segment] #[inline(never)] pub fn next_test_port() -> u16 { unsafe { return rust_dbg_next_port(base_port() as libc::uintptr_t) as u16; @@ -373,7 +370,6 @@ pub fn next_test_port() -> u16 { } /// Get a temporary path which could be the location of a unix socket -#[fixed_stack_segment] #[inline(never)] pub fn next_test_unix() -> Path { if cfg!(unix) { os::tmpdir().join(rand::task_rng().gen_ascii_str(20)) diff --git a/src/libstd/rt/thread.rs b/src/libstd/rt/thread.rs index b21a8f5981d..5e535d994f9 100644 --- a/src/libstd/rt/thread.rs +++ b/src/libstd/rt/thread.rs @@ -68,8 +68,6 @@ impl Thread { #[cfg(windows)] fn native_thread_create(thread_start: extern "C" fn(*libc::c_void) -> rust_thread_return, tramp: ~~fn()) -> rust_thread { - #[fixed_stack_segment]; - unsafe { let ptr: *mut libc::c_void = cast::transmute(tramp); CreateThread(ptr::mut_null(), DEFAULT_STACK_SIZE, thread_start, ptr, 0, ptr::mut_null()) @@ -78,7 +76,6 @@ fn native_thread_create(thread_start: extern "C" fn(*libc::c_void) -> rust_threa #[cfg(windows)] fn native_thread_join(native: rust_thread) { - #[fixed_stack_segment]; use libc::consts::os::extra::INFINITE; unsafe { WaitForSingleObject(native, INFINITE); } } @@ -86,8 +83,6 @@ fn native_thread_join(native: rust_thread) { #[cfg(unix)] fn native_thread_create(thread_start: extern "C" fn(*libc::c_void) -> rust_thread_return, tramp: ~~fn()) -> rust_thread { - #[fixed_stack_segment]; - use unstable::intrinsics; let mut native: libc::pthread_t = unsafe { intrinsics::uninit() }; @@ -107,13 +102,11 @@ fn native_thread_create(thread_start: extern "C" fn(*libc::c_void) -> rust_threa #[cfg(unix)] fn native_thread_join(native: rust_thread) { - #[fixed_stack_segment]; unsafe { assert!(pthread_join(native, ptr::null()) == 0) } } impl Drop for Thread { fn drop(&mut self) { - #[fixed_stack_segment]; #[inline(never)]; assert!(self.joined); } } diff --git a/src/libstd/rt/thread_local_storage.rs b/src/libstd/rt/thread_local_storage.rs index 4ae1fe59a37..8fa64852846 100644 --- a/src/libstd/rt/thread_local_storage.rs +++ b/src/libstd/rt/thread_local_storage.rs @@ -20,8 +20,6 @@ use libc::types::os::arch::extra::{DWORD, LPVOID, BOOL}; pub type Key = pthread_key_t; #[cfg(unix)] -#[fixed_stack_segment] -#[inline(never)] pub unsafe fn create(key: &mut Key) { assert_eq!(0, pthread_key_create(key, null())); } @@ -49,20 +47,7 @@ type pthread_key_t = ::libc::c_uint; #[cfg(unix)] extern { fn pthread_key_create(key: *mut pthread_key_t, dtor: *u8) -> c_int; - - // This function is a very cheap operation on both osx and unix. On osx, it - // turns out it's just three instructions, and on unix it's a cheap function - // which only uses a very small amount of stack. - // - // This is not marked as such because we think it has a small stack, but - // rather we would like to be able to fetch information from - // thread-local-storage when a task is running very low on its stack budget. - // For example, this is invoked whenever stack overflow is detected, and we - // obviously have very little budget to deal with (certainly not anything - // close to a fixed_stack_segment) - #[rust_stack] fn pthread_getspecific(key: pthread_key_t) -> *mut c_void; - #[rust_stack] fn pthread_setspecific(key: pthread_key_t, value: *mut c_void) -> c_int; } @@ -70,8 +55,6 @@ extern { pub type Key = DWORD; #[cfg(windows)] -#[fixed_stack_segment] -#[inline(never)] pub unsafe fn create(key: &mut Key) { static TLS_OUT_OF_INDEXES: DWORD = 0xFFFFFFFF; *key = TlsAlloc(); @@ -91,13 +74,7 @@ pub unsafe fn get(key: Key) -> *mut c_void { #[cfg(windows)] extern "system" { fn TlsAlloc() -> DWORD; - - // See the reasoning in pthread_getspecific as to why this has the - // 'rust_stack' attribute, as this function was also verified to only - // require a small amount of stack. - #[rust_stack] fn TlsGetValue(dwTlsIndex: DWORD) -> LPVOID; - #[rust_stack] fn TlsSetValue(dwTlsIndex: DWORD, lpTlsvalue: LPVOID) -> BOOL; } diff --git a/src/libstd/rt/util.rs b/src/libstd/rt/util.rs index 070985fb0a5..50f73becef2 100644 --- a/src/libstd/rt/util.rs +++ b/src/libstd/rt/util.rs @@ -24,8 +24,6 @@ pub static ENFORCE_SANITY: bool = true || !cfg!(rtopt) || cfg!(rtdebug) || cfg!( /// Get the number of cores available pub fn num_cpus() -> uint { - #[fixed_stack_segment]; #[inline(never)]; - unsafe { return rust_get_num_cpus(); } @@ -146,7 +144,6 @@ memory and partly incapable of presentation to others.", abort(); fn abort() -> ! { - #[fixed_stack_segment]; #[inline(never)]; unsafe { libc::abort() } } } diff --git a/src/libstd/run.rs b/src/libstd/run.rs index ec0e0f5c932..844f61dda0b 100644 --- a/src/libstd/run.rs +++ b/src/libstd/run.rs @@ -296,7 +296,6 @@ impl Process { * * The process's exit code */ -#[fixed_stack_segment] #[inline(never)] pub fn process_status(prog: &str, args: &[~str]) -> int { let mut prog = Process::new(prog, args, ProcessOptions { env: None, diff --git a/src/libstd/task/mod.rs b/src/libstd/task/mod.rs index e75f8f6237f..51c11b69972 100644 --- a/src/libstd/task/mod.rs +++ b/src/libstd/task/mod.rs @@ -1145,12 +1145,14 @@ fn test_spawn_sched_childs_on_default_sched() { mod testrt { use libc; - externfn!(fn rust_dbg_lock_create() -> *libc::c_void) - externfn!(fn rust_dbg_lock_destroy(lock: *libc::c_void)) - externfn!(fn rust_dbg_lock_lock(lock: *libc::c_void)) - externfn!(fn rust_dbg_lock_unlock(lock: *libc::c_void)) - externfn!(fn rust_dbg_lock_wait(lock: *libc::c_void)) - externfn!(fn rust_dbg_lock_signal(lock: *libc::c_void)) + extern { + pub fn rust_dbg_lock_create() -> *libc::c_void; + pub fn rust_dbg_lock_destroy(lock: *libc::c_void); + pub fn rust_dbg_lock_lock(lock: *libc::c_void); + pub fn rust_dbg_lock_unlock(lock: *libc::c_void); + pub fn rust_dbg_lock_wait(lock: *libc::c_void); + pub fn rust_dbg_lock_signal(lock: *libc::c_void); + } } #[test] 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 { |
