about summary refs log tree commit diff
path: root/src/libstd/rt/stack.rs
AgeCommit message (Collapse)AuthorLines
2014-05-19rustc: Add official support for weak failureAlex Crichton-6/+32
This commit is part of the ongoing libstd facade efforts (cc #13851). The compiler now recognizes some language items as "extern { fn foo(...); }" and will automatically perform the following actions: 1. The foreign function has a pre-defined name. 2. The crate and downstream crates can only be built as rlibs until a crate defines the lang item itself. 3. The actual lang item has a pre-defined name. This is essentially nicer compiler support for the hokey core-depends-on-std-failure scheme today, but it is implemented the same way. The details are a little more hidden under the covers. In addition to failure, this commit promotes the eh_personality and rust_stack_exhausted functions to official lang items. The compiler can generate calls to these functions, causing linkage errors if they are left undefined. The checking for these items is not as precise as it could be. Crates compiling with `-Z no-landing-pads` will not need the eh_personality lang item, and crates compiling with no split stacks won't need the stack exhausted lang item. For ease, however, these items are checked for presence in all final outputs of the compiler. It is quite easy to define dummy versions of the functions necessary: #[lang = "stack_exhausted"] extern fn stack_exhausted() { /* ... */ } #[lang = "eh_personality"] extern fn eh_personality() { /* ... */ } cc #11922, rust_stack_exhausted is now a lang item cc #13851, libcollections is blocked on eh_personality becoming weak
2014-05-06librustc: Remove `~EXPR`, `~TYPE`, and `~PAT` from the language, exceptPatrick Walton-1/+2
for `~str`/`~[]`. Note that `~self` still remains, since I forgot to add support for `Box<self>` before the snapshot. How to update your code: * Instead of `~EXPR`, you should write `box EXPR`. * Instead of `~TYPE`, you should write `Box<Type>`. * Instead of `~PATTERN`, you should write `box PATTERN`. [breaking-change]
2014-02-25std: Tweak stack overflow printing for robustnessAlex Crichton-5/+10
The printing of the error message on stack overflow had two sometimes false assumptions previously. The first is that a local task was always available (it called Local::take) and the second is that it used println! instead of manually writing. The first assumption isn't necessarily true because while stack overflow will likely only be detected in situations that a local task is available, it's not guaranteed to always be in TLS. For example, during a println! call a task may be blocking, causing it to be unavailable. By using Local::try_take(), we can be resilient against these occurrences. The second assumption could lead to odd behavior because the stdout logger can be overwritten to run arbitrary code. Currently this should be possible, but the utility is much diminished because a stack overflow translates to an abort() instead of a failure.
2014-02-23std: Move unstable::stack to rt::stackBrian Anderson-0/+276
2013-12-24green: Rip the bandaid off, introduce libgreenAlex Crichton-78/+0
This extracts everything related to green scheduling from libstd and introduces a new libgreen crate. This mostly involves deleting most of std::rt and moving it to libgreen. Along with the movement of code, this commit rearchitects many functions in the scheduler in order to adapt to the fact that Local::take now *only* works on a Task, not a scheduler. This mostly just involved threading the current green task through in a few locations, but there were one or two spots where things got hairy. There are a few repercussions of this commit: * tube/rc have been removed (the runtime implementation of rc) * There is no longer a "single threaded" spawning mode for tasks. This is now encompassed by 1:1 scheduling + communication. Convenience methods have been introduced that are specific to libgreen to assist in the spawning of pools of schedulers.
2013-12-15std::vec: convert to(_mut)_ptr to as_... methods on &[] and &mut [].Huon Wilson-2/+2
2013-12-15Move std::{str,vec}::raw::set_len to an unsafe method on Owned{Vector,Str}.Huon Wilson-1/+1
2013-11-11Remove #[fixed_stack_segment] and #[rust_stack]Alex Crichton-4/+0
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
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-1/+0
2013-10-23Making fields in std and extra : private #4386reedlepee-2/+3
2013-09-16switch Drop to `&mut self`Daniel Micay-1/+1
2013-08-27Remove offset_inbounds for an unsafe offset functionAlex Crichton-1/+3
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-0/+4
2013-07-30implement pointer arithmetic with GEPDaniel Micay-1/+1
Closes #8118, #7136 ~~~rust extern mod extra; use std::vec; use std::ptr; fn bench_from_elem(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = vec::from_elem(1024, 0u8); } } fn bench_set_memory(b: &mut extra::test::BenchHarness) { do b.iter { let mut v: ~[u8] = vec::with_capacity(1024); unsafe { let vp = vec::raw::to_mut_ptr(v); ptr::set_memory(vp, 0, 1024); vec::raw::set_len(&mut v, 1024); } } } fn bench_vec_repeat(b: &mut extra::test::BenchHarness) { do b.iter { let v: ~[u8] = ~[0u8, ..1024]; } } ~~~ Before: test bench_from_elem ... bench: 415 ns/iter (+/- 17) test bench_set_memory ... bench: 85 ns/iter (+/- 4) test bench_vec_repeat ... bench: 83 ns/iter (+/- 3) After: test bench_from_elem ... bench: 84 ns/iter (+/- 2) test bench_set_memory ... bench: 84 ns/iter (+/- 5) test bench_vec_repeat ... bench: 84 ns/iter (+/- 3)
2013-06-25Change finalize -> drop.Luqman Aden-1/+1
2013-06-03rename the Ptr trait to RawPtrDaniel Micay-1/+1
Closes #6607
2013-06-01Remove all uses of `pub impl`. rs=stylePatrick Walton-5/+5
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-0/+76
This only changes the directory names; it does not change the "real" metadata names.