From 469cfa4c08ea4f044c6246972576e20d73f1aad4 Mon Sep 17 00:00:00 2001 From: Justin Ethier Date: Sat, 21 Nov 2015 02:57:32 -0500 Subject: [PATCH] Debugging - how could gc_sweep/p be a value type? --- gc.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/gc.c b/gc.c index fe05c426..f212b1bb 100644 --- a/gc.c +++ b/gc.c @@ -345,14 +345,23 @@ void *gc_alloc(gc_heap *h, size_t size, char *obj, gc_thread_data *thd, int *hea #if GC_DEBUG_PRINTFS fprintf(stdout, "alloc %p size = %d\n", result, size); #endif + +// TODO: Debug check, remove (ifdef it) once GC is stabilized +if (is_value_type(result)) { + printf("Invalid allocated address - is a value type %p\n", result); +} + return result; } size_t gc_allocated_bytes(object obj) { tag_type t; - if (is_value_type(obj)) - return gc_heap_align(1); + if (is_value_type(obj)) { + fprintf(stdout, "gc_allocated_bytes - passed value type %p\n", obj); + exit(1); + //return gc_heap_align(1); + } t = type_of(obj); if (t == cons_tag) return gc_heap_align(sizeof(cons_type)); if (t == macro_tag) return gc_heap_align(sizeof(macro_type));