Added debug statements

This commit is contained in:
Justin Ethier 2015-10-23 19:48:55 -04:00
parent a9c0411a16
commit 7a45137ca2
2 changed files with 8 additions and 2 deletions

5
gc.c
View file

@ -225,7 +225,9 @@ fprintf(stdout, "sweep heap %p, size = %d\n", h, h->size);
if ((char *)r == (char *)p) { // this is a free block, skip it
p = (object) (((char *)p) + r->size);
fprintf(stdout, "skip free block %p size = %d\n", p, r->size);
#if GC_DEBUG_PRINTFS
fprintf(stdout, "skip free block %p size = %d\n", p, r->size);
#endif
continue;
}
size = gc_heap_align(gc_allocated_bytes(p));
@ -308,6 +310,7 @@ void gc_thr_grow_move_buffer(gc_thread_data *d)
}
d->moveBuf = realloc(d->moveBuf, d->moveBufLen * sizeof(void *));
printf("grew moveBuffer, len = %d\n", d->moveBufLen);
}
void gc_thr_add_to_move_buffer(gc_thread_data *d, int *alloci, object obj)

View file

@ -2708,8 +2708,11 @@ void GC(cont, args, num_args) closure cont; object *args; int num_args;
scani++;
}
//fprintf(stdout, "DEBUG done minor GC, alloci = %d\n", alloci);
// Check if we need to do a major GC
if (heap_grown) {
time_t majorStart = time(NULL);
size_t freed = 0, max_freed = 0;
fprintf(stdout, "DEBUG, starting major mark/sweep GC\n"); // JAE DEBUG
gc_mark(Cyc_heap, cont);
@ -2717,7 +2720,7 @@ fprintf(stdout, "DEBUG, starting major mark/sweep GC\n"); // JAE DEBUG
gc_mark(Cyc_heap, args[i]);
}
max_freed = gc_collect(Cyc_heap, &freed);
printf("done, freed = %d, max_freed = %d\n", freed, max_freed);
printf("done, freed = %d, max_freed = %d, elapsed = %ld\n", freed, max_freed, time(NULL) - majorStart);
//JAE_DEBUG++;
//if (JAE_DEBUG == 2) exit(1); // JAE DEBUG
}