add new compilation flag GC_DEBUG_DETAIL
This commit is contained in:
parent
4004282e50
commit
4b326e4f6e
|
@ -25,9 +25,10 @@
|
||||||
/* #define DEBUG 1 */
|
/* #define DEBUG 1 */
|
||||||
|
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
# define GC_DEBUG 0
|
|
||||||
# define GC_STRESS 1
|
# define GC_STRESS 1
|
||||||
# define VM_DEBUG 1
|
# define VM_DEBUG 1
|
||||||
|
# define GC_DEBUG 1
|
||||||
|
# define GC_DEBUG_DETAIL 0
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
12
src/gc.c
12
src/gc.c
|
@ -405,12 +405,12 @@ gc_sweep_phase(pic_state *pic)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
base = pic->heap->base;
|
base = pic->heap->base;
|
||||||
#if GC_DEBUG
|
#if GC_DEBUG_DETAIL
|
||||||
printf("base = %p\nbase->s.ptr = %p\n", base, base->s.ptr);
|
printf("base = %p\nbase->s.ptr = %p\n", base, base->s.ptr);
|
||||||
#endif
|
#endif
|
||||||
for (p = base->s.ptr; ; p = p->s.ptr) {
|
for (p = base->s.ptr; ; p = p->s.ptr) {
|
||||||
|
|
||||||
#if GC_DEBUG
|
#if GC_DEBUG_DETAIL
|
||||||
puts("sweeping block");
|
puts("sweeping block");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -418,7 +418,7 @@ gc_sweep_phase(pic_state *pic)
|
||||||
|
|
||||||
for (bp = p + p->s.size; bp != p->s.ptr; bp += bp->s.size) {
|
for (bp = p + p->s.size; bp != p->s.ptr; bp += bp->s.size) {
|
||||||
|
|
||||||
#if GC_DEBUG
|
#if GC_DEBUG_DETAIL
|
||||||
printf(" bp = %p\n p = %p\n p->s.ptr = %p\n endp = %p\n",bp, p, p->s.ptr, pic->heap->endp);
|
printf(" bp = %p\n p = %p\n p->s.ptr = %p\n endp = %p\n",bp, p, p->s.ptr, pic->heap->endp);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
@ -426,7 +426,7 @@ gc_sweep_phase(pic_state *pic)
|
||||||
break;
|
break;
|
||||||
if (gc_is_marked(bp)) {
|
if (gc_is_marked(bp)) {
|
||||||
|
|
||||||
#if GC_DEBUG
|
#if GC_DEBUG_DETAIL
|
||||||
printf("marked:\t\t\t");
|
printf("marked:\t\t\t");
|
||||||
pic_debug(pic, pic_obj_value((struct pic_object *)(bp + 1)));
|
pic_debug(pic, pic_obj_value((struct pic_object *)(bp + 1)));
|
||||||
printf("\n");
|
printf("\n");
|
||||||
|
@ -436,10 +436,6 @@ gc_sweep_phase(pic_state *pic)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if GC_DEBUG
|
|
||||||
puts("unmarked");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/* free! */
|
/* free! */
|
||||||
gc_finalize_object(pic, (struct pic_object *)(bp + 1));
|
gc_finalize_object(pic, (struct pic_object *)(bp + 1));
|
||||||
if (bp + bp->s.size == p->s.ptr) {
|
if (bp + bp->s.size == p->s.ptr) {
|
||||||
|
|
Loading…
Reference in New Issue