From dc19539bff8acdf2269c0e6fc8dc865d77f48f60 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Wed, 24 Feb 2016 22:30:40 -0500 Subject: [PATCH] Tweak GC debugging --- gc.c | 2 +- runtime.c | 10 +++++++--- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/gc.c b/gc.c index 4bf62dc7..4d7f0615 100644 --- a/gc.c +++ b/gc.c @@ -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)) { diff --git a/runtime.c b/runtime.c index d2a3bc02..c1395085 100644 --- a/runtime.c +++ b/runtime.c @@ -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); }