move debug prints

This commit is contained in:
Yuichi Nishiwaki 2013-10-14 17:07:09 +09:00
parent daa65bdecf
commit c53bf58e7e
1 changed files with 3 additions and 4 deletions

View File

@ -240,9 +240,10 @@ gc_sweep_phase(pic_state *pic)
} }
} }
static void void
pic_gc_run(pic_state *pic) pic_gc_run(pic_state *pic)
{ {
puts("gc run!");
gc_mark_phase(pic); gc_mark_phase(pic);
gc_sweep_phase(pic); gc_sweep_phase(pic);
} }
@ -252,14 +253,12 @@ pic_obj_alloc(pic_state *pic, size_t size, enum pic_tt tt)
{ {
struct pic_object *obj; struct pic_object *obj;
pic_gc_run(pic);
obj = (struct pic_object *)gc_alloc(pic, size); obj = (struct pic_object *)gc_alloc(pic, size);
if (obj == NULL) { if (obj == NULL) {
puts("gc run!");
pic_gc_run(pic); pic_gc_run(pic);
obj = (struct pic_object *)gc_alloc(pic, size); obj = (struct pic_object *)gc_alloc(pic, size);
if (obj == NULL) if (obj == NULL)
pic_raise(pic, "memory exhausted"); pic_raise(pic, "GC memory exhausted");
} }
obj->tt = tt; obj->tt = tt;