add a new runtime log (::rt::box) and make boxed_region use it

This commit is contained in:
Niko Matsakis 2012-04-13 17:52:36 -07:00
parent 8be944e89e
commit 21f74be2c1
3 changed files with 11 additions and 10 deletions

View File

@ -20,12 +20,11 @@ rust_opaque_box *boxed_region::malloc(type_desc *td) {
if (live_allocs) live_allocs->prev = box;
live_allocs = box;
# ifdef DUMP_BOXED_REGION
fprintf(stderr, "Allocated box %p with td %p,"
" size %lu==%lu+%lu, align %lu, prev %p, next %p\n",
box, td, total_size, header_size, body_size, body_align,
box->prev, box->next);
# endif
LOG(rust_get_current_task(), box,
"@malloc()=%p with td %p, size %lu==%lu+%lu, "
"align %lu, prev %p, next %p\n",
box, td, total_size, header_size, body_size, body_align,
box->prev, box->next);
return box;
}
@ -46,10 +45,9 @@ void boxed_region::free(rust_opaque_box *box) {
// double frees (kind of).
assert(box->td != NULL);
# ifdef DUMP_BOXED_REGION
fprintf(stderr, "Freed box %p with td %p, prev %p, next %p\n",
box, box->td, box->prev, box->next);
# endif
LOG(rust_get_current_task(), box,
"@free(%p) with td %p, prev %p, next %p\n",
box, box->td, box->prev, box->next);
if (box->prev) box->prev->next = box->next;
if (box->next) box->next->prev = box->prev;

View File

@ -236,6 +236,7 @@ void print_crate_log_map(const cratemap* map) {
// These are pseudo-modules used to control logging in the runtime.
uint32_t log_rt_mem;
uint32_t log_rt_box;
uint32_t log_rt_comm;
uint32_t log_rt_task;
uint32_t log_rt_dom;
@ -251,6 +252,7 @@ uint32_t log_rt_callback;
static const mod_entry _rt_module_map[] =
{{"::rt::mem", &log_rt_mem},
{"::rt::box", &log_rt_box},
{"::rt::comm", &log_rt_comm},
{"::rt::task", &log_rt_task},
{"::rt::dom", &log_rt_dom},

View File

@ -58,6 +58,7 @@ private:
void update_log_settings(void* crate_map, char* settings);
extern uint32_t log_rt_mem;
extern uint32_t log_rt_box;
extern uint32_t log_rt_comm;
extern uint32_t log_rt_task;
extern uint32_t log_rt_dom;