Tweak GC debugging

This commit is contained in:
Justin Ethier 2016-02-24 22:30:40 -05:00
parent 7c49e59ad6
commit dc19539bff
2 changed files with 8 additions and 4 deletions

2
gc.c
View file

@ -446,7 +446,7 @@ void *gc_alloc(gc_heap *h, size_t size, char *obj, gc_thread_data *thd, int *hea
exit(1); // could throw error, but OOM is a major issue, so...
}
}
#if GC_DEBUG_TRACE
#if GC_DEBUG_VERBOSE
fprintf(stderr, "alloc %p size = %zu, obj=%p, tag=%ld, mark=%d\n", result, size, obj, type_of(obj), mark(((object)result)));
// Debug check, should no longer be necessary
//if (is_value_type(result)) {

View file

@ -2361,6 +2361,10 @@ int gc_minor(void *data, object low_limit, object high_limit, closure cont, obje
int scani = 0, alloci = 0;
int heap_grown = 0;
#if GC_DEBUG_TRACE
fprintf(stderr, "started minor GC\n");
#endif
//fprintf(stdout, "DEBUG, started minor GC\n"); // JAE DEBUG
// Prevent overrunning buffer
if (num_args > NUM_GC_ANS) {
@ -2474,6 +2478,9 @@ int gc_minor(void *data, object low_limit, object high_limit, closure cont, obje
}
scani++;
}
#if GC_DEBUG_TRACE
fprintf(stderr, "done with minor GC\n");
#endif
return alloci;
}
@ -2490,9 +2497,6 @@ void GC(void *data, closure cont, object *args, int num_args)
int alloci = gc_minor(data, low_limit, high_limit, cont, args, num_args);
// Cooperate with the collector thread
gc_mut_cooperate((gc_thread_data *)data, alloci);
#if GC_DEBUG_TRACE
fprintf(stderr, "done with minor GC\n");
#endif
// Let it all go, Neo...
longjmp(*(((gc_thread_data *)data)->jmp_start), 1);
}