diff options
| author | bors <bors@rust-lang.org> | 2014-05-22 01:06:25 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-05-22 01:06:25 -0700 |
| commit | 022a7b3cfb8014f79c79ba85a8273d16cda6e423 (patch) | |
| tree | 69f59e3fdf58d2fa67fb10a218562f2b6362be86 /src/liballoc | |
| parent | 22e2204c3d6f09f5bd1311d1d0a7b086e19b1b96 (diff) | |
| parent | f1ce693e618dbf4273e0e1af8fd101e15964f5f0 (diff) | |
| download | rust-022a7b3cfb8014f79c79ba85a8273d16cda6e423.tar.gz rust-022a7b3cfb8014f79c79ba85a8273d16cda6e423.zip | |
auto merge of #14322 : thestinger/rust/secret_santa_heap, r=alexcrichton
Diffstat (limited to 'src/liballoc')
| -rw-r--r-- | src/liballoc/heap.rs | 26 |
1 files changed, 13 insertions, 13 deletions
diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index 69cd82a981a..631b72cb897 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -9,7 +9,7 @@ // except according to those terms. // FIXME: #13994: port to the sized deallocation API when available -// FIXME: #13996: need a way to mark the `allocate` and `reallocate` return values as `noalias` +// FIXME: #13996: mark the `allocate` and `reallocate` return value as `noalias` and `nonnull` use core::intrinsics::{abort, cttz32}; use core::option::{None, Option}; @@ -119,14 +119,8 @@ pub fn stats_print() { /// The allocator for unique pointers. #[cfg(not(test))] #[lang="exchange_malloc"] -#[inline(always)] -pub unsafe fn exchange_malloc_(size: uint, align: uint) -> *mut u8 { - exchange_malloc(size, align) -} - -/// The allocator for unique pointers. #[inline] -pub unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 { +unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 { // The compiler never calls `exchange_free` on ~ZeroSizeType, so zero-size // allocations can point to this `static`. It would be incorrect to use a null // pointer, due to enums assuming types like unique pointers are never null. @@ -139,14 +133,20 @@ pub unsafe fn exchange_malloc(size: uint, align: uint) -> *mut u8 { } } -#[cfg(not(test))] +#[cfg(not(test), stage0)] #[lang="exchange_free"] #[inline] -// FIXME: #13994 (rustc should pass align and size here) unsafe fn exchange_free(ptr: *mut u8) { deallocate(ptr, 0, 8); } +#[cfg(not(test), not(stage0))] +#[lang="exchange_free"] +#[inline] +unsafe fn exchange_free(ptr: *mut u8, size: uint, align: uint) { + deallocate(ptr, size, align); +} + // FIXME: #7496 #[cfg(not(test))] #[lang="closure_exchange_malloc"] @@ -167,8 +167,8 @@ unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uin #[doc(hidden)] #[deprecated] #[cfg(not(test))] -pub unsafe extern "C" fn rust_malloc(size: uint, align: uint) -> *mut u8 { - exchange_malloc(size, align) +pub unsafe extern "C" fn rust_allocate(size: uint, align: uint) -> *mut u8 { + allocate(size, align) } // hack for libcore @@ -176,7 +176,7 @@ pub unsafe extern "C" fn rust_malloc(size: uint, align: uint) -> *mut u8 { #[doc(hidden)] #[deprecated] #[cfg(not(test))] -pub unsafe extern "C" fn rust_free(ptr: *mut u8, size: uint, align: uint) { +pub unsafe extern "C" fn rust_deallocate(ptr: *mut u8, size: uint, align: uint) { deallocate(ptr, size, align) } |
