From 72a92b2e14927aa2bedcc739aa8de62d66632ed9 Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Fri, 5 Sep 2014 10:39:36 -0400 Subject: implement sized deallocation Closes #13994 --- src/liballoc/heap.rs | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/liballoc') diff --git a/src/liballoc/heap.rs b/src/liballoc/heap.rs index 204d8ee3a41..62010ca8916 100644 --- a/src/liballoc/heap.rs +++ b/src/liballoc/heap.rs @@ -178,7 +178,10 @@ mod imp { flags: c_int) -> *mut c_void; fn je_xallocx(ptr: *mut c_void, size: size_t, extra: size_t, flags: c_int) -> size_t; + #[cfg(stage0)] fn je_dallocx(ptr: *mut c_void, flags: c_int); + #[cfg(not(stage0))] + fn je_sdallocx(ptr: *mut c_void, size: size_t, flags: c_int); fn je_nallocx(size: size_t, flags: c_int) -> size_t; fn je_malloc_stats_print(write_cb: Option, @@ -229,11 +232,19 @@ mod imp { } #[inline] + #[cfg(stage0)] pub unsafe fn deallocate(ptr: *mut u8, _size: uint, align: uint) { let flags = align_to_flags(align); je_dallocx(ptr as *mut c_void, flags) } + #[inline] + #[cfg(not(stage0))] + pub unsafe fn deallocate(ptr: *mut u8, size: uint, align: uint) { + let flags = align_to_flags(align); + je_sdallocx(ptr as *mut c_void, size as size_t, flags) + } + #[inline] pub fn usable_size(size: uint, align: uint) -> uint { let flags = align_to_flags(align); -- cgit 1.4.1-3-g733a5