about summary refs log tree commit diff
path: root/src/libstd/rt
diff options
context:
space:
mode:
authorbors <bors@rust-lang.org>2014-02-13 15:17:21 -0800
committerbors <bors@rust-lang.org>2014-02-13 15:17:21 -0800
commit94d453e459107ed1c5d76f693686b29d31cdc58c (patch)
treeb586a7c785fa57253b3ba1bcaaee5ae1ea167411 /src/libstd/rt
parentcfb87f10ec7d41d0e7f8c68fbb908fc195517d41 (diff)
parent640b22852f59e4505cedfd02c01cc343d5ec0d9e (diff)
downloadrust-94d453e459107ed1c5d76f693686b29d31cdc58c.tar.gz
rust-94d453e459107ed1c5d76f693686b29d31cdc58c.zip
auto merge of #12248 : alexcrichton/rust/rollup, r=alexcrichton
This passed `make check` locally, so hopefully it passes on bors!
Diffstat (limited to 'src/libstd/rt')
-rw-r--r--src/libstd/rt/global_heap.rs30
-rw-r--r--src/libstd/rt/local_heap.rs74
2 files changed, 1 insertions, 103 deletions
diff --git a/src/libstd/rt/global_heap.rs b/src/libstd/rt/global_heap.rs
index 2f553585f38..4bce16706ee 100644
--- a/src/libstd/rt/global_heap.rs
+++ b/src/libstd/rt/global_heap.rs
@@ -10,8 +10,6 @@
 
 use libc::{c_void, size_t, free, malloc, realloc};
 use ptr::{RawPtr, mut_null};
-#[cfg(stage0)]
-use unstable::intrinsics::TyDesc;
 use unstable::intrinsics::abort;
 use unstable::raw;
 use mem::size_of;
@@ -75,15 +73,7 @@ pub unsafe fn exchange_malloc(size: uint) -> *u8 {
 }
 
 // FIXME: #7496
-#[cfg(not(test), stage0)]
-#[lang="closure_exchange_malloc"]
-#[inline]
-pub unsafe fn closure_exchange_malloc_(td: *u8, size: uint) -> *u8 {
-    closure_exchange_malloc(td, size)
-}
-
-// FIXME: #7496
-#[cfg(not(test), not(stage0))]
+#[cfg(not(test))]
 #[lang="closure_exchange_malloc"]
 #[inline]
 pub unsafe fn closure_exchange_malloc_(drop_glue: fn(*mut u8), size: uint, align: uint) -> *u8 {
@@ -91,24 +81,6 @@ pub unsafe fn closure_exchange_malloc_(drop_glue: fn(*mut u8), size: uint, align
 }
 
 #[inline]
-#[cfg(stage0)]
-pub unsafe fn closure_exchange_malloc(td: *u8, size: uint) -> *u8 {
-    let td = td as *TyDesc;
-    let size = size;
-
-    assert!(td.is_not_null());
-
-    let total_size = get_box_size(size, (*td).align);
-    let p = malloc_raw(total_size);
-
-    let alloc = p as *mut raw::Box<()>;
-    (*alloc).type_desc = td;
-
-    alloc as *u8
-}
-
-#[inline]
-#[cfg(not(stage0))]
 pub unsafe fn closure_exchange_malloc(drop_glue: fn(*mut u8), size: uint, align: uint) -> *u8 {
     let total_size = get_box_size(size, align);
     let p = malloc_raw(total_size);
diff --git a/src/libstd/rt/local_heap.rs b/src/libstd/rt/local_heap.rs
index 3bee9e48b60..023f712d3a0 100644
--- a/src/libstd/rt/local_heap.rs
+++ b/src/libstd/rt/local_heap.rs
@@ -21,8 +21,6 @@ use rt::env;
 use rt::global_heap;
 use rt::local::Local;
 use rt::task::Task;
-#[cfg(stage0)]
-use unstable::intrinsics::TyDesc;
 use unstable::raw;
 use vec::ImmutableVector;
 
@@ -61,29 +59,6 @@ impl LocalHeap {
     }
 
     #[inline]
-    #[cfg(stage0)]
-    pub fn alloc(&mut self, td: *TyDesc, size: uint) -> *mut Box {
-        let total_size = global_heap::get_box_size(size, unsafe { (*td).align });
-        let alloc = self.memory_region.malloc(total_size);
-        {
-            // Make sure that we can't use `mybox` outside of this scope
-            let mybox: &mut Box = unsafe { cast::transmute(alloc) };
-            // Clear out this box, and move it to the front of the live
-            // allocations list
-            mybox.type_desc = td;
-            mybox.ref_count = 1;
-            mybox.prev = ptr::mut_null();
-            mybox.next = self.live_allocs;
-            if !self.live_allocs.is_null() {
-                unsafe { (*self.live_allocs).prev = alloc; }
-            }
-            self.live_allocs = alloc;
-        }
-        return alloc;
-    }
-
-    #[inline]
-    #[cfg(not(stage0))]
     pub fn alloc(&mut self, drop_glue: fn(*mut u8), size: uint, align: uint) -> *mut Box {
         let total_size = global_heap::get_box_size(size, align);
         let alloc = self.memory_region.malloc(total_size);
@@ -126,41 +101,6 @@ impl LocalHeap {
     }
 
     #[inline]
-    #[cfg(stage0)]
-    pub fn free(&mut self, alloc: *mut Box) {
-        {
-            // Make sure that we can't use `mybox` outside of this scope
-            let mybox: &mut Box = unsafe { cast::transmute(alloc) };
-            assert!(!mybox.type_desc.is_null());
-
-            // Unlink it from the linked list
-            if !mybox.prev.is_null() {
-                unsafe { (*mybox.prev).next = mybox.next; }
-            }
-            if !mybox.next.is_null() {
-                unsafe { (*mybox.next).prev = mybox.prev; }
-            }
-            if self.live_allocs == alloc {
-                self.live_allocs = mybox.next;
-            }
-
-            // Destroy the box memory-wise
-            if self.poison_on_free {
-                unsafe {
-                    let ptr: *mut u8 = cast::transmute(&mybox.data);
-                    ptr::set_memory(ptr, 0xab, (*mybox.type_desc).size);
-                }
-            }
-            mybox.prev = ptr::mut_null();
-            mybox.next = ptr::mut_null();
-            mybox.type_desc = ptr::null();
-        }
-
-        self.memory_region.free(alloc);
-    }
-
-    #[inline]
-    #[cfg(not(stage0))]
     pub fn free(&mut self, alloc: *mut Box) {
         {
             // Make sure that we can't use `mybox` outside of this scope
@@ -339,20 +279,6 @@ impl Drop for MemoryRegion {
 }
 
 #[inline]
-#[cfg(stage0)]
-pub unsafe fn local_malloc(td: *u8, size: uint) -> *u8 {
-    // FIXME: Unsafe borrow for speed. Lame.
-    let task: Option<*mut Task> = Local::try_unsafe_borrow();
-    match task {
-        Some(task) => {
-            (*task).heap.alloc(td as *TyDesc, size) as *u8
-        }
-        None => rtabort!("local malloc outside of task")
-    }
-}
-
-#[inline]
-#[cfg(not(stage0))]
 pub unsafe fn local_malloc(drop_glue: fn(*mut u8), size: uint, align: uint) -> *u8 {
     // FIXME: Unsafe borrow for speed. Lame.
     let task: Option<*mut Task> = Local::try_unsafe_borrow();