mirror of
https://github.com/justinethier/cyclone.git
synced 2025-07-12 07:17:37 +02:00
Added debug code
This commit is contained in:
parent
4beac74189
commit
ee01b2679b
3 changed files with 5 additions and 3 deletions
4
gc.c
4
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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue