Added debug traces

This commit is contained in:
Justin Ethier 2015-11-26 22:45:22 -05:00
parent 604eb682c5
commit b5849e10ed
2 changed files with 5 additions and 1 deletions

4
gc.c
View file

@ -858,8 +858,10 @@ void gc_mut_cooperate(gc_thread_data *thd)
}
else if (thd->gc_status == STATUS_SYNC2) {
// Mark thread "roots"
printf("gc_cont %p\n", thd->gc_cont);
gc_mark_gray(thd, thd->gc_cont);
for (i = 0; i < thd->gc_num_args; i++) {
printf("gc_args[%d] %p\n", i, thd->gc_args[i]);
gc_mark_gray(thd, thd->gc_args[i]);
}
thd->gc_alloc_color = ATOMIC_GET(&gc_color_mark);
@ -1016,7 +1018,7 @@ void gc_collector_mark_gray(object parent, object obj)
// could lead to stack corruption.
if (is_object_type(obj) && mark(obj) == gc_color_clear) {
mark_stack = vpbuffer_add(mark_stack, &mark_stack_len, mark_stack_i++, obj);
printf("mark gray parent = %p obj = %p\n", parent, obj);
printf("mark gray parent = %p (%ld) obj = %p\n", parent, type_of(parent), obj);
}
}

View file

@ -2441,6 +2441,7 @@ void gc_mark_globals()
printf("(gc_mark_globals heap: %p size: %d)\n", h, (unsigned int)gc_heap_total_size(h));
#endif
// Mark global variables
printf("Cyc_global_variables %p\n");
gc_mark_black(Cyc_global_variables); // Internal global used by the runtime
// Marking it ensures all glos are marked
{
@ -2449,6 +2450,7 @@ void gc_mark_globals()
cvar_type *c = (cvar_type *)car(l);
object glo = *(c->pvar);
if (!nullp(glo)) {
printf("global pvar %p\n", glo);
gc_mark_black(glo); // Mark actual object the global points to
}
}