about summary refs log tree commit diff
path: root/src/liballoc/heap.rs
AgeCommit message (Collapse)AuthorLines
2018-06-11Remove deprecated heap modulesSimon Sapin-110/+0
The heap.rs file was already unused.
2018-06-11Remove alloc::Opaque and use *mut u8 as pointer type for GlobalAllocMike Hommey-6/+6
2018-04-22Remove Alloc::oomSteven Fackler-1/+1
2018-04-12Rename alloc::Void to alloc::OpaqueSimon Sapin-6/+6
2018-04-12Use NonNull<Void> instead of *mut u8 in the Alloc traitMike Hommey-5/+17
Fixes #49608
2018-04-12realloc with a new size only, not a full new layout.Simon Sapin-4/+4
Changing the alignment with realloc is not supported.
2018-04-12Remove the now-unit-struct AllocErr parameter of oom()Simon Sapin-2/+2
2018-04-12Separate alloc::heap::Alloc trait for stage0 #[global_allocator]Simon Sapin-0/+98
2018-04-12Rename `heap` modules in the core, alloc, and std crates to `alloc`Simon Sapin-291/+0
2018-04-12Inline docs for the heap module’s reexportsSimon Sapin-0/+2
2018-03-29Move the alloc::allocator module to core::heapSimon Sapin-1/+1
This is the `Alloc` trait and its dependencies.
2018-03-16Remove deprecated unstable alloc::heap::EMPTY constantSimon Sapin-8/+0
2018-01-24Add missing micro version number component in stability attributes.Simon Sapin-1/+1
2018-01-20Rename std::ptr::Shared to NonNullSimon Sapin-1/+1
`Shared` is now a deprecated `type` alias. CC https://github.com/rust-lang/rust/issues/27730#issuecomment-352800629
2017-08-28std: Mark allocation functions as nounwindAlex Crichton-0/+10
This commit flags all allocation-related functions in liballoc as "this can't unwind" which should largely resolve the size-related issues found on #42808. The documentation on the trait was updated with such a restriction (they can't panic) as well as some other words about the relative instability about implementing a bullet-proof allocator. Closes #42808
2017-08-11std: Tag OOM functions as `#[cold]`Alex Crichton-0/+2
This was forgotten from #42727 by accident, but these functions are rarely called and codegen can be improved in LLVM with the `#[cold]` tag.
2017-07-05rustc: Implement the #[global_allocator] attributeAlex Crichton-182/+171
This PR is an implementation of [RFC 1974] which specifies a new method of defining a global allocator for a program. This obsoletes the old `#![allocator]` attribute and also removes support for it. [RFC 1974]: https://github.com/rust-lang/rfcs/pull/197 The new `#[global_allocator]` attribute solves many issues encountered with the `#![allocator]` attribute such as composition and restrictions on the crate graph itself. The compiler now has much more control over the ABI of the allocator and how it's implemented, allowing much more freedom in terms of how this feature is implemented. cc #27389
2017-06-15Add impl of `Alloc` for the global rust heap.Felix S. Klock II-1/+78
Alpha-renamed `HeapAllocator` to `HeapAlloc`. `<HeapAlloc as Alloc>::alloc_zeroed` is hooked up to `heap::allocate_zeroed`. `HeapAlloc::realloc` falls back on alloc+copy+realloc on align mismatch.
2017-05-04Deprecate heap::EMPTY in favour of Unique::empty or otherwise.Alexis Beingessner-2/+4
2017-04-22cache attributes of items from foreign cratesAriel Ben-Yehuda-4/+2
this avoids parsing item attributes on each call to `item_attrs`, which takes off 33% (!) of translation time and 50% (!) of trans-item collection time.
2017-04-15Specialize Vec::from_elem<u8> to use calloc or memsetMatt Brubeck-0/+34
Fixes #38723.
2017-02-03Bump version, upgrade bootstrapAlex Crichton-8/+0
This commit updates the version number to 1.17.0 as we're not on that version of the nightly compiler, and at the same time this updates src/stage0.txt to bootstrap from freshly minted beta compiler and beta Cargo.
2016-12-26Remove extra lang item, exchange_free; use box_free instead.Mark Simulacrum-0/+1
Trans used to insert code equivalent to box_free in a wrapper around exchange_free, and that code is now removed from trans.
2016-12-20Inline base::malloc_raw_dyn.Mark-Simulacrum-0/+1
Move comment about not unwinding into liballoc.
2016-11-11[breaking-change] change the `box_free` item to accept pointers to unsized typesOliver 'ker' Schneider-4/+5
2016-05-28rustfmt liballoc folderSrinivas Reddy Thatiparthy-1/+1
2016-02-04Synthesize calls to box_free language itemSimonas Kazlauskas-0/+13
This gets rid of Drop(Free, _) MIR construct by synthesizing a call to language item which takes care of dropping instead.
2015-11-24rustfmt: liballoc, liballoc_*, libarenaNick Cameron-1/+1
2015-09-24Better function callsNick Cameron-2/+6
2015-09-24rustfmt liballocNick Cameron-8/+17
2015-08-15alloc: Add issues for all unstable featuresAlex Crichton-1/+2
2015-08-14rustc: Allow changing the default allocatorAlex Crichton-371/+19
This commit is an implementation of [RFC 1183][rfc] which allows swapping out the default allocator on nightly Rust. No new stable surface area should be added as a part of this commit. [rfc]: https://github.com/rust-lang/rfcs/pull/1183 Two new attributes have been added to the compiler: * `#![needs_allocator]` - this is used by liballoc (and likely only liballoc) to indicate that it requires an allocator crate to be in scope. * `#![allocator]` - this is a indicator that the crate is an allocator which can satisfy the `needs_allocator` attribute above. The ABI of the allocator crate is defined to be a set of symbols that implement the standard Rust allocation/deallocation functions. The symbols are not currently checked for exhaustiveness or typechecked. There are also a number of restrictions on these crates: * An allocator crate cannot transitively depend on a crate that is flagged as needing an allocator (e.g. allocator crates can't depend on liballoc). * There can only be one explicitly linked allocator in a final image. * If no allocator is explicitly requested one will be injected on behalf of the compiler. Binaries and Rust dylibs will use jemalloc by default where available and staticlibs/other dylibs will use the system allocator by default. Two allocators are provided by the distribution by default, `alloc_system` and `alloc_jemalloc` which operate as advertised. Closes #27389
2015-06-17alloc: Split apart the global `alloc` featureAlex Crichton-1/+6
2015-06-13Switch to direct HeapAlloc on Windows when not using jemallocPeter Atashian-17/+102
Signed-off-by: Peter Atashian <retep998@gmail.com>
2015-05-11Rollup merge of #25254 - cgaebel:check-sizes-on-allocate, r=GankroSteve Klabnik-0/+12
They're only enabled in debug builds, but a panic is usually more welcome than UB in debug builds. Previous review at https://github.com/rust-lang/rust/pull/22069 r? @Gankro cc @huon
2015-05-09[liballoc] Adds checks for UB during allocation.Clark Gaebel-0/+12
They're only enabled in debug builds, but a panic is usually more welcome than UB in debug builds.
2015-05-09Convert #[lang="..."] to #[lang = "..."]Nick Hamann-2/+2
In my opinion this looks nicer, but also it matches the whitespace generally used for stability markers more closely.
2015-04-27std: Prepare for linking to muslAlex Crichton-1/+3
This commit modifies the standard library and its dependencies to link correctly when built against MUSL. This primarily ensures that the right libraries are linked against and when they're linked against they're linked against statically.
2015-04-24Change name of unit test sub-module to "tests".Johannes Oertel-1/+1
Changes the style guidelines regarding unit tests to recommend using a sub-module named "tests" instead of "test" for unit tests as "test" might clash with imports of libtest.
2015-04-16Suppress improper_ctypes warnings when compiling liballoc with external_featuresKrzysztof Drewniak-0/+1
2015-03-31Auto merge of #23549 - aturon:stab-num, r=alexcrichtonbors-1/+0
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change] r? @alexcrichton
2015-03-31Stabilize std::numAaron Turon-1/+0
This commit stabilizes the `std::num` module: * The `Int` and `Float` traits are deprecated in favor of (1) the newly-added inherent methods and (2) the generic traits available in rust-lang/num. * The `Zero` and `One` traits are reintroduced in `std::num`, which together with various other traits allow you to recover the most common forms of generic programming. * The `FromStrRadix` trait, and associated free function, is deprecated in favor of inherent implementations. * A wide range of methods and constants for both integers and floating point numbers are now `#[stable]`, having been adjusted for integer guidelines. * `is_positive` and `is_negative` are renamed to `is_sign_positive` and `is_sign_negative`, in order to address #22985 * The `Wrapping` type is moved to `std::num` and stabilized; `WrappingOps` is deprecated in favor of inherent methods on the integer types, and direct implementation of operations on `Wrapping<X>` for each concrete integer type `X`. Closes #22985 Closes #21069 [breaking-change]
2015-03-30std: Standardize (input, output) param orderingsAlex Crichton-1/+1
This functions swaps the order of arguments to a few functions that previously took (output, input) parameters, but now take (input, output) parameters (in that order). The affected functions are: * ptr::copy * ptr::copy_nonoverlapping * slice::bytes::copy_memory * intrinsics::copy * intrinsics::copy_nonoverlapping Closes #22890 [breaking-change]
2015-03-23Add note about pointer state after the call.Steve Klabnik-0/+3
Fixes #23422
2015-03-18Register new snapshotsAlex Crichton-4/+0
2015-03-16remove importsJorge Aparicio-1/+0
2015-03-16impl<T> *const T, impl<T> *mut TJorge Aparicio-0/+1
2015-03-13Add an "allocator" attribute to mark functions as allocatorsBjörn Steinbrink-0/+1
When this attribute is applied to a function, its return value gets the noalias attribute, which is how you tell LLVM that the function returns a "new" pointer that doesn't alias anything accessible to the caller, i.e. it acts like a memory allocator. Plain malloc doesn't need this attribute because LLVM already knows about malloc and adds the attribute itself.
2015-03-03Add `: Box<_>` or `::Box<_>` type annotations to various places.Felix S. Klock II-1/+2
This is the kind of change that one is expected to need to make to accommodate overloaded-`box`. ---- Note that this is not *all* of the changes necessary to accommodate Issue 22181. It is merely the subset of those cases where there was already a let-binding in place that made it easy to add the necesasry type ascription. (For unnamed intermediate `Box` values, one must go down a different route; `Box::new` is the option that maximizes portability, but has potential inefficiency depending on whether the call is inlined.) ---- There is one place worth note, `run-pass/coerce-match.rs`, where I used an ugly form of `Box<_>` type ascription where I would have preferred to use `Box::new` to accommodate overloaded-`box`. I deliberately did not use `Box::new` here, because that is already done in coerce-match-calls.rs. ---- Precursor for overloaded-`box` and placement-`in`; see Issue 22181.
2015-02-26Fixed build with jemalloc disabledValerii Hiora-1/+1