about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2013-05-06 20:14:54 -0400
committerNiko Matsakis <niko@alum.mit.edu>2013-05-06 20:14:54 -0400
commitce45f390dd55fbd8ebaf1be07ad1b3b3bb5d2f4d (patch)
tree5ac96c81a8f5cc3e78696f545551c77b523a2f9d /src
parent8b32bde408bb6fdf6fcf4e7c2727fff3a31dd8b1 (diff)
downloadrust-ce45f390dd55fbd8ebaf1be07ad1b3b3bb5d2f4d.tar.gz
rust-ce45f390dd55fbd8ebaf1be07ad1b3b3bb5d2f4d.zip
Remove debug_mem since @graydon said it conflicted with GC changes
Diffstat (limited to 'src')
-rw-r--r--src/libcore/cleanup.rs10
-rw-r--r--src/libcore/unstable/lang.rs22
2 files changed, 2 insertions, 30 deletions
diff --git a/src/libcore/cleanup.rs b/src/libcore/cleanup.rs
index 06f6185586d..424cc348309 100644
--- a/src/libcore/cleanup.rs
+++ b/src/libcore/cleanup.rs
@@ -167,8 +167,7 @@ fn debug_mem() -> bool {
 #[cfg(notest)]
 #[lang="annihilate"]
 pub unsafe fn annihilate() {
-    use unstable::lang::{local_free};
-    use unstable::lang;
+    use unstable::lang::local_free;
     use io::WriterUtil;
     use io;
     use libc;
@@ -192,10 +191,8 @@ pub unsafe fn annihilate() {
     for each_live_alloc(true) |box, uniq| {
         stats.n_total_boxes += 1;
         if uniq {
-            lang::debug_mem("Managed-uniq: ", &*box);
             stats.n_unique_boxes += 1;
         } else {
-            lang::debug_mem("Immortalizing: ", &*box);
             (*box).header.ref_count = managed::raw::RC_IMMORTAL;
         }
     }
@@ -207,13 +204,9 @@ pub unsafe fn annihilate() {
     // callback, as the original value may have been freed.
     for each_live_alloc(false) |box, uniq| {
         if !uniq {
-            lang::debug_mem("Invoking tydesc/glue on: ", &*box);
             let tydesc: *TypeDesc = transmute(copy (*box).header.type_desc);
             let drop_glue: DropGlue = transmute(((*tydesc).drop_glue, 0));
-            lang::debug_mem("Box data: ", &(*box).data);
-            lang::debug_mem("Type descriptor: ", tydesc);
             drop_glue(to_unsafe_ptr(&tydesc), transmute(&(*box).data));
-            lang::debug_mem("Dropped ", &*box);
         }
     }
 
@@ -225,7 +218,6 @@ pub unsafe fn annihilate() {
     // not be valid after.
     for each_live_alloc(true) |box, uniq| {
         if !uniq {
-            lang::debug_mem("About to free: ", &*box);
             stats.n_bytes_freed +=
                 (*((*box).header.type_desc)).size
                 + sys::size_of::<BoxRepr>();
diff --git a/src/libcore/unstable/lang.rs b/src/libcore/unstable/lang.rs
index 934874968d7..8153c2d43d9 100644
--- a/src/libcore/unstable/lang.rs
+++ b/src/libcore/unstable/lang.rs
@@ -153,9 +153,7 @@ unsafe fn fail_borrowed(box: *mut BoxRepr, file: *c_char, line: size_t) {
 #[lang="exchange_malloc"]
 #[inline(always)]
 pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
-    let result = transmute(exchange_alloc::malloc(transmute(td), transmute(size)));
-    debug_mem("exchange_malloc: ", result);
-    return result;
+    transmute(exchange_alloc::malloc(transmute(td), transmute(size)))
 }
 
 /// Because this code is so perf. sensitive, use a static constant so that
@@ -163,23 +161,6 @@ pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
 static ENABLE_DEBUG: bool = false;
 
 #[inline]
-pub fn debug_mem<T>(tag: &'static str, p: *const T) {
-    //! A useful debugging function that prints a pointer + tag + newline
-    //! without allocating memory.
-
-    if ENABLE_DEBUG && ::rt::env::get().debug_mem {
-        debug_mem_slow(tag, p);
-    }
-
-    fn debug_mem_slow<T>(tag: &'static str, p: *const T) {
-        let dbg = STDERR_FILENO as io::fd_t;
-        dbg.write_str(tag);
-        dbg.write_hex(p as uint);
-        dbg.write_str("\n");
-    }
-}
-
-#[inline]
 unsafe fn debug_borrow<T>(tag: &'static str,
                           p: *const T,
                           old_bits: uint,
@@ -252,7 +233,6 @@ impl DebugPrints for io::fd_t {
 #[lang="exchange_free"]
 #[inline(always)]
 pub unsafe fn exchange_free(ptr: *c_char) {
-    debug_mem("exchange_free: ", ptr);
     exchange_alloc::free(transmute(ptr))
 }