mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 23:37:38 +02:00
Debugging - how could gc_sweep/p be a value type?
This commit is contained in:
parent
d13327cfd4
commit
469cfa4c08
1 changed files with 11 additions and 2 deletions
13
gc.c
13
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
|
#if GC_DEBUG_PRINTFS
|
||||||
fprintf(stdout, "alloc %p size = %d\n", result, size);
|
fprintf(stdout, "alloc %p size = %d\n", result, size);
|
||||||
#endif
|
#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;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t gc_allocated_bytes(object obj)
|
size_t gc_allocated_bytes(object obj)
|
||||||
{
|
{
|
||||||
tag_type t;
|
tag_type t;
|
||||||
if (is_value_type(obj))
|
if (is_value_type(obj)) {
|
||||||
return gc_heap_align(1);
|
fprintf(stdout, "gc_allocated_bytes - passed value type %p\n", obj);
|
||||||
|
exit(1);
|
||||||
|
//return gc_heap_align(1);
|
||||||
|
}
|
||||||
t = type_of(obj);
|
t = type_of(obj);
|
||||||
if (t == cons_tag) return gc_heap_align(sizeof(cons_type));
|
if (t == cons_tag) return gc_heap_align(sizeof(cons_type));
|
||||||
if (t == macro_tag) return gc_heap_align(sizeof(macro_type));
|
if (t == macro_tag) return gc_heap_align(sizeof(macro_type));
|
||||||
|
|
Loading…
Add table
Reference in a new issue