Skip to content

Commit ce45f39

Browse files
committed
Remove debug_mem since @graydon said it conflicted with GC changes
1 parent 8b32bde commit ce45f39

File tree

2 files changed

+2
-30
lines changed

2 files changed

+2
-30
lines changed

src/libcore/cleanup.rs

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,7 @@ fn debug_mem() -> bool {
167167
#[cfg(notest)]
168168
#[lang="annihilate"]
169169
pub unsafe fn annihilate() {
170-
use unstable::lang::{local_free};
171-
use unstable::lang;
170+
use unstable::lang::local_free;
172171
use io::WriterUtil;
173172
use io;
174173
use libc;
@@ -192,10 +191,8 @@ pub unsafe fn annihilate() {
192191
for each_live_alloc(true) |box, uniq| {
193192
stats.n_total_boxes += 1;
194193
if uniq {
195-
lang::debug_mem("Managed-uniq: ", &*box);
196194
stats.n_unique_boxes += 1;
197195
} else {
198-
lang::debug_mem("Immortalizing: ", &*box);
199196
(*box).header.ref_count = managed::raw::RC_IMMORTAL;
200197
}
201198
}
@@ -207,13 +204,9 @@ pub unsafe fn annihilate() {
207204
// callback, as the original value may have been freed.
208205
for each_live_alloc(false) |box, uniq| {
209206
if !uniq {
210-
lang::debug_mem("Invoking tydesc/glue on: ", &*box);
211207
let tydesc: *TypeDesc = transmute(copy (*box).header.type_desc);
212208
let drop_glue: DropGlue = transmute(((*tydesc).drop_glue, 0));
213-
lang::debug_mem("Box data: ", &(*box).data);
214-
lang::debug_mem("Type descriptor: ", tydesc);
215209
drop_glue(to_unsafe_ptr(&tydesc), transmute(&(*box).data));
216-
lang::debug_mem("Dropped ", &*box);
217210
}
218211
}
219212

@@ -225,7 +218,6 @@ pub unsafe fn annihilate() {
225218
// not be valid after.
226219
for each_live_alloc(true) |box, uniq| {
227220
if !uniq {
228-
lang::debug_mem("About to free: ", &*box);
229221
stats.n_bytes_freed +=
230222
(*((*box).header.type_desc)).size
231223
+ sys::size_of::<BoxRepr>();

src/libcore/unstable/lang.rs

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -153,32 +153,13 @@ unsafe fn fail_borrowed(box: *mut BoxRepr, file: *c_char, line: size_t) {
153153
#[lang="exchange_malloc"]
154154
#[inline(always)]
155155
pub unsafe fn exchange_malloc(td: *c_char, size: uintptr_t) -> *c_char {
156-
let result = transmute(exchange_alloc::malloc(transmute(td), transmute(size)));
157-
debug_mem("exchange_malloc: ", result);
158-
return result;
156+
transmute(exchange_alloc::malloc(transmute(td), transmute(size)))
159157
}
160158

161159
/// Because this code is so perf. sensitive, use a static constant so that
162160
/// debug printouts are compiled out most of the time.
163161
static ENABLE_DEBUG: bool = false;
164162

165-
#[inline]
166-
pub fn debug_mem<T>(tag: &'static str, p: *const T) {
167-
//! A useful debugging function that prints a pointer + tag + newline
168-
//! without allocating memory.
169-
170-
if ENABLE_DEBUG && ::rt::env::get().debug_mem {
171-
debug_mem_slow(tag, p);
172-
}
173-
174-
fn debug_mem_slow<T>(tag: &'static str, p: *const T) {
175-
let dbg = STDERR_FILENO as io::fd_t;
176-
dbg.write_str(tag);
177-
dbg.write_hex(p as uint);
178-
dbg.write_str("\n");
179-
}
180-
}
181-
182163
#[inline]
183164
unsafe fn debug_borrow<T>(tag: &'static str,
184165
p: *const T,
@@ -252,7 +233,6 @@ impl DebugPrints for io::fd_t {
252233
#[lang="exchange_free"]
253234
#[inline(always)]
254235
pub unsafe fn exchange_free(ptr: *c_char) {
255-
debug_mem("exchange_free: ", ptr);
256236
exchange_alloc::free(transmute(ptr))
257237
}
258238

0 commit comments

Comments
 (0)