about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorDaniel Micay <danielmicay@gmail.com>2013-06-30 03:22:18 -0400
committerDaniel Micay <danielmicay@gmail.com>2013-06-30 16:24:47 -0400
commit4a29d6eb3f20c2b7a05bb9c9c2f964da606e39ca (patch)
tree050f52b9890f32f8e2836b456b4e042c14e2ef5d /src/libstd
parent45e2582e09dd97d01a01e351c47da210bd6803f3 (diff)
downloadrust-4a29d6eb3f20c2b7a05bb9c9c2f964da606e39ca.tar.gz
rust-4a29d6eb3f20c2b7a05bb9c9c2f964da606e39ca.zip
add a closure_exchange_malloc lang item
this makes the exchange allocation header completely unused, and leaves
it uninitialized
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/rt/global_heap.rs14
1 files changed, 14 insertions, 0 deletions
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
@@ -73,6 +73,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);
 
     let box: *mut BoxRepr = p as *mut BoxRepr;