pic->irep is a root marker

This commit is contained in:
Yuichi Nishiwaki 2014-01-18 16:55:11 +09:00
parent 11e4f1644b
commit 42c097a91f
2 changed files with 9 additions and 0 deletions

View File

@ -316,6 +316,9 @@ codegen(codegen_state *state, pic_value obj, bool tailpos)
irep->code[irep->clen].u.i = k; irep->code[irep->clen].u.i = k;
irep->clen++; irep->clen++;
/* prevent GC from hanging */
pic->irep[k] = NULL;
pic->irep[k] = codegen_lambda(state, obj); pic->irep[k] = codegen_lambda(state, obj);
break; break;
} }

View File

@ -492,6 +492,12 @@ gc_mark_phase(pic_state *pic)
gc_mark(pic, pic->globals[i]); gc_mark(pic, pic->globals[i]);
} }
/* irep */
for (i = 0; i < pic->ilen; ++i) {
if (pic->irep[i])
gc_mark_object(pic, (struct pic_object *)pic->irep[i]);
}
/* pool */ /* pool */
for (i = 0; i < pic->plen; ++i) { for (i = 0; i < pic->plen; ++i) {
gc_mark(pic, pic->pool[i]); gc_mark(pic, pic->pool[i]);