From 4a29d6eb3f20c2b7a05bb9c9c2f964da606e39ca Mon Sep 17 00:00:00 2001 From: Daniel Micay Date: Sun, 30 Jun 2013 03:22:18 -0400 Subject: add a closure_exchange_malloc lang item this makes the exchange allocation header completely unused, and leaves it uninitialized --- src/libstd/rt/global_heap.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) (limited to 'src/libstd') diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs index 5d4ac37055c..f669dc753d6 100644 --- a/src/libstd/rt/global_heap.rs +++ b/src/libstd/rt/global_heap.rs @@ -72,6 +72,20 @@ pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char { assert!(td.is_not_null()); + let total_size = get_box_size(size, (*td).align); + malloc_raw(total_size as uint) as *c_char +} + +// FIXME: #7496 +#[cfg(not(test))] +#[lang="closure_exchange_malloc"] +#[inline] +pub unsafe fn closure_exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char { + let td = td as *TyDesc; + let size = size as uint; + + assert!(td.is_not_null()); + let total_size = get_box_size(size, (*td).align); let p = malloc_raw(total_size as uint); -- cgit 1.4.1-3-g733a5