about summary refs log tree commit diff
path: root/src/libstd/rt/local_heap.rs
AgeCommit message (Collapse)AuthorLines
2014-06-06std: Extract librustrt out of libstdAlex Crichton-339/+0
As part of the libstd facade efforts, this commit extracts the runtime interface out of the standard library into a standalone crate, librustrt. This crate will provide the following services: * Definition of the rtio interface * Definition of the Runtime interface * Implementation of the Task structure * Implementation of task-local-data * Implementation of task failure via unwinding via libunwind * Implementation of runtime initialization and shutdown * Implementation of thread-local-storage for the local rust Task Notably, this crate avoids the following services: * Thread creation and destruction. The crate does not require the knowledge of an OS threading system, and as a result it seemed best to leave out the `rt::thread` module from librustrt. The librustrt module does depend on mutexes, however. * Implementation of backtraces. There is no inherent requirement for the runtime to be able to generate backtraces. As will be discussed later, this functionality continues to live in libstd rather than librustrt. As usual, a number of architectural changes were required to make this crate possible. Users of "stable" functionality will not be impacted by this change, but users of the `std::rt` module will likely note the changes. A list of architectural changes made is: * The stdout/stderr handles no longer live directly inside of the `Task` structure. This is a consequence of librustrt not knowing about `std::io`. These two handles are now stored inside of task-local-data. The handles were originally stored inside of the `Task` for perf reasons, and TLD is not currently as fast as it could be. For comparison, 100k prints goes from 59ms to 68ms (a 15% slowdown). This appeared to me to be an acceptable perf loss for the successful extraction of a librustrt crate. * The `rtio` module was forced to duplicate more functionality of `std::io`. As the module no longer depends on `std::io`, `rtio` now defines structures such as socket addresses, addrinfo fiddly bits, etc. The primary change made was that `rtio` now defines its own `IoError` type. This type is distinct from `std::io::IoError` in that it does not have an enum for what error occurred, but rather a platform-specific error code. The native and green libraries will be updated in later commits for this change, and the bulk of this effort was put behind updating the two libraries for this change (with `rtio`). * Printing a message on task failure (along with the backtrace) continues to live in libstd, not in librustrt. This is a consequence of the above decision to move the stdout/stderr handles to TLD rather than inside the `Task` itself. The unwinding API now supports registration of global callback functions which will be invoked when a task fails, allowing for libstd to register a function to print a message and a backtrace. The API for registering a callback is experimental and unsafe, as the ramifications of running code on unwinding is pretty hairy. * The `std::unstable::mutex` module has moved to `std::rt::mutex`. * The `std::unstable::sync` module has been moved to `std::rt::exclusive` and the type has been rewritten to not internally have an Arc and to have an RAII guard structure when locking. Old code should stop using `Exclusive` in favor of the primitives in `libsync`, but if necessary, old code should port to `Arc<Exclusive<T>>`. * The local heap has been stripped down to have fewer debugging options. None of these were tested, and none of these have been used in a very long time. [breaking-change]
2014-05-17std: Refactor liballoc out of lib{std,sync}Alex Crichton-1/+2
This commit is part of the libstd facade RFC, issue #13851. This creates a new library, liballoc, which is intended to be the core allocation library for all of Rust. It is pinned on the basic assumption that an allocation failure is an abort or failure. This module has inherited the heap/libc_heap modules from std::rt, the owned/rc modules from std, and the arc module from libsync. These three pointers are currently the three most core pointer implementations in Rust. The UnsafeArc type in std::sync should be considered deprecated and replaced by Arc<Unsafe<T>>. This commit does not currently migrate to this type, but future commits will continue this refactoring.
2014-05-11core: Remove the cast moduleAlex Crichton-10/+9
This commit revisits the `cast` module in libcore and libstd, and scrutinizes all functions inside of it. The result was to remove the `cast` module entirely, folding all functionality into the `mem` module. Specifically, this is the fate of each function in the `cast` module. * transmute - This function was moved to `mem`, but it is now marked as #[unstable]. This is due to planned changes to the `transmute` function and how it can be invoked (see the #[unstable] comment). For more information, see RFC 5 and #12898 * transmute_copy - This function was moved to `mem`, with clarification that is is not an error to invoke it with T/U that are different sizes, but rather that it is strongly discouraged. This function is now #[stable] * forget - This function was moved to `mem` and marked #[stable] * bump_box_refcount - This function was removed due to the deprecation of managed boxes as well as its questionable utility. * transmute_mut - This function was previously deprecated, and removed as part of this commit. * transmute_mut_unsafe - This function doesn't serve much of a purpose when it can be achieved with an `as` in safe code, so it was removed. * transmute_lifetime - This function was removed because it is likely a strong indication that code is incorrect in the first place. * transmute_mut_lifetime - This function was removed for the same reasons as `transmute_lifetime` * copy_lifetime - This function was moved to `mem`, but it is marked `#[unstable]` now due to the likelihood of being removed in the future if it is found to not be very useful. * copy_mut_lifetime - This function was also moved to `mem`, but had the same treatment as `copy_lifetime`. * copy_lifetime_vec - This function was removed because it is not used today, and its existence is not necessary with DST (copy_lifetime will suffice). In summary, the cast module was stripped down to these functions, and then the functions were moved to the `mem` module. transmute - #[unstable] transmute_copy - #[stable] forget - #[stable] copy_lifetime - #[unstable] copy_mut_lifetime - #[unstable] [breaking-change]
2014-05-10rename `global_heap` -> `libc_heap`Daniel Micay-4/+3
This module only contains wrappers for malloc and realloc with out-of-memory checks.
2014-05-10initial port of the exchange allocator to jemallocDaniel Micay-2/+3
In stage0, all allocations are 8-byte aligned. Passing a size and alignment to free is not yet implemented everywhere (0 size and 8 align are used as placeholders). Fixing this is part of #13994. Closes #13616
2014-04-15std: Impl Deref/DerefMut for a borrowed taskAlex Crichton-2/+1
2014-04-11libtest: rename `BenchHarness` to `Bencher`Liigo Zhuang-5/+5
Closes #12640
2014-03-31std: Switch field privacy as necessaryAlex Crichton-4/+4
2014-03-21libstd: Add some methods to `Vec<T>`.Patrick Walton-1/+1
2014-03-20rename std::vec_ng -> std::vecDaniel Micay-1/+1
Closes #12771
2014-03-20rename std::vec -> std::sliceDaniel Micay-1/+1
Closes #12702
2014-02-23std: Remove unstable::langBrian Anderson-1/+18
Put the lonely lang items here closer to the code they are calling.
2014-02-23std: Move raw to std::rawBrian Anderson-1/+1
Issue #1457
2014-02-20move extra::test to libtestLiigo Zhuang-1/+2
2014-02-14Register new snapshotsAlex Crichton-3/+0
This enables the parser error for `extern mod` => `extern crate` transitions.
2014-02-13Don't allocate in LocalHeap::new()Alex Crichton-7/+8
One of these is allocated for every task, trying to cut down on allocations cc #11389
2014-02-13Register new snapshotsAlex Crichton-74/+0
2014-02-07remove type descriptors from proc and @TDaniel Micay-0/+61
This also drops support for the managed pointer POISON_ON_FREE feature as it's not worth adding back the support for it. After a snapshot, the leftovers can be removed.
2014-02-02std,extra: remove use of & support for @[].Huon Wilson-1/+1
2014-01-26Removed all instances of XXX in preparation for relaxing of FIXME ruleSalem Talha-2/+2
2014-01-22Replace C types with Rust types in libstd, closes #7313Florian Hahn-7/+5
2014-01-15libstd: Added more #[inline] annotations and replaced uses of `libc::abort` ↵Eduard Burtescu-0/+12
with the intrinsic.
2014-01-07std: Fill in all missing importsAlex Crichton-0/+3
Fallout from the previous commits
2013-12-15librustc: Remove identifiers named `box`, since it's about to become a keyword.Patrick Walton-20/+20
2013-12-10librustuv: RAII-ify `Local::borrow`, and remove some 12 Cells.Patrick Walton-1/+2
2013-12-08Remove dead codesKiet Tran-0/+2
2013-11-26test: Remove non-procedure uses of `do` from compiletest, libstd tests,Patrick Walton-2/+2
compile-fail tests, run-fail tests, and run-pass tests.
2013-11-26libstd: Remove all non-`proc` uses of `do` from libstdPatrick Walton-9/+3
2013-10-26Rewrite boxed_region/memory_region in RustAlex Crichton-64/+238
This drops more of the old C++ runtime to rather be written in rust. A few features were lost along the way, but hopefully not too many. The main loss is that there are no longer backtraces associated with allocations (rust doesn't have a way of acquiring those just yet). Other than that though, I believe that the rest of the debugging utilities made their way over into rust. Closes #8704
2013-10-23Removed Unnecessary comments and white spaces #4386reedlepee-1/+0
2013-10-23Making fields in std and extra : private #4386reedlepee-2/+3
2013-10-11De-pub some private runtime componentsAlex Crichton-0/+11
This change was waiting for privacy to get sorted out, which should be true now that #8215 has landed. Closes #4427
2013-10-08rm useless fast_ffi attributesDaniel Micay-7/+0
this is no longer used by the compiler
2013-09-16switch Drop to `&mut self`Daniel Micay-1/+1
2013-08-27librustc: Ensure that type parameters are in the right positions in paths.Patrick Walton-3/+4
This removes the stacking of type parameters that occurs when invoking trait methods, and fixes all places in the standard library that were relying on it. It is somewhat awkward in places; I think we'll probably want something like the `Foo::<for T>::new()` syntax.
2013-08-23rt: Memory regions are never synchronized nowBrian Anderson-5/+2
2013-08-19Add externfn macro and correctly label fixed_stack_segmentsNiko Matsakis-0/+5
2013-08-12std: Re-optimize tls access on local allocation pathBrian Anderson-2/+7
I did this once but acciddentally undid it in a later patch.
2013-08-09Remove the C++ runtime. SayonaraBrian Anderson-27/+4
2013-08-09std: Fix perf of local allocations in newschedBrian Anderson-7/+15
Mostly optimizing TLS accesses to bring local heap allocation performance closer to that of oldsched. It's not completely at parity but removing the branches involved in supporting oldsched and optimizing pthread_get/setspecific to instead use our dedicated TCB slot will probably make up for it.
2013-08-02librustc: Disallow "unsafe" for external functionsPatrick Walton-1/+1
2013-07-26Consolidate raw representations of rust valuesAlex Crichton-3/+3
This moves the raw struct layout of closures, vectors, boxes, and strings into a new `unstable::raw` module. This is meant to be a centralized location to find information for the layout of these values. As safe method, `repr`, is provided to convert a rust value to its raw representation. Unsafe methods to convert back are not provided because they are rarely used and too numerous to write an implementation for each (not much of a common pattern).
2013-07-22std: add #[bench] benchmarks for global and local heaps.Graydon Hoare-0/+19
2013-07-03Merge remote-tracking branch 'mozilla/master'Brian Anderson-1/+1
Conflicts: src/libextra/test.rs src/libstd/at_vec.rs src/libstd/cleanup.rs src/libstd/rt/comm.rs src/libstd/rt/global_heap.rs src/libstd/task/spawn.rs src/libstd/unstable/lang.rs src/libstd/vec.rs src/rt/rustrt.def.in src/test/run-pass/extern-pub.rs
2013-06-25Change finalize -> drop.Luqman Aden-1/+1
2013-06-24std: Make box annihilator work with newschedBrian Anderson-1/+49
2013-06-24std: Rewrite vec_reserve_shared_actual in RustBrian Anderson-0/+9
2013-05-22libstd: Rename libcore to libstd and libstd to libextra; update makefiles.Patrick Walton-0/+80
This only changes the directory names; it does not change the "real" metadata names.