From ee01b2679b17cdbac8bd8a9fc64c5acda46a6749 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Wed, 21 Oct 2015 22:55:58 -0400 Subject: [PATCH] Added debug code --- gc.c | 4 ++-- include/cyclone/runtime-main.h | 3 ++- runtime.c | 1 + 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/gc.c b/gc.c index 3ef09817..a88d1af0 100644 --- a/gc.c +++ b/gc.c @@ -219,7 +219,7 @@ size_t gc_sweep(gc_heap *h, size_t *sum_freed_ptr) } size = gc_heap_align(gc_allocated_bytes(p)); -#if GC_DEBUG_PRINTFS +//#if GC_DEBUG_PRINTFS // DEBUG if (!is_object_type(p)) fprintf(stderr, "sweep: invalid object at %p", p); @@ -228,7 +228,7 @@ size_t gc_sweep(gc_heap *h, size_t *sum_freed_ptr) if (r && ((char *)p) + size > (char *)r) fprintf(stderr, "sweep: bad size at %p + %d > %p", p, size, r); // END DEBUG -#endif +//#endif if (!mark(p)) { #if GC_DEBUG_PRINTFS diff --git a/include/cyclone/runtime-main.h b/include/cyclone/runtime-main.h index c26a0f81..c8476c1e 100644 --- a/include/cyclone/runtime-main.h +++ b/include/cyclone/runtime-main.h @@ -57,7 +57,8 @@ static void Cyc_main (stack_size,heap_size,stack_base) printf("main: Allocating and initializing heap...\n"); #endif - Cyc_heap = gc_heap_create(heap_size, 0, 0); + //Cyc_heap = gc_heap_create(heap_size / 2, 0, 0); + Cyc_heap = gc_heap_create(1024, 0, 0); Cyc_thread = (gc_thread_data *)malloc(sizeof(gc_thread_data)); Cyc_thread->moveBufLen = 0; gc_thr_grow_move_buffer(Cyc_thread); // Initialize the buffer diff --git a/runtime.c b/runtime.c index 64975bf5..41e89435 100644 --- a/runtime.c +++ b/runtime.c @@ -2380,6 +2380,7 @@ size_t gc_collect(gc_heap *h, size_t *sum_freed) char *gc_move(char *obj, gc_thread_data *thd, int *alloci, int *heap_grown) { if (!is_object_type(obj)) return obj; +printf("DEBUG gc_move type = %ld\n", type_of(obj)); // JAE DEBUG switch(type_of(obj)){ case cons_tag: { list hp = gc_alloc(Cyc_heap, sizeof(cons_type), heap_grown); // hp ==> new heap object