mark error handlers

This commit is contained in:
Yuichi Nishiwaki 2014-07-24 11:45:16 +09:00
parent 1c718fd4c1
commit 0111cd19ed
1 changed files with 16 additions and 2 deletions

View File

@ -403,7 +403,7 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
struct pic_cont *cont = (struct pic_cont *)obj; struct pic_cont *cont = (struct pic_cont *)obj;
pic_value *stack; pic_value *stack;
pic_callinfo *ci; pic_callinfo *ci;
int i; size_t i;
/* block */ /* block */
gc_mark_object(pic, (struct pic_object *)cont->blk); gc_mark_object(pic, (struct pic_object *)cont->blk);
@ -421,10 +421,17 @@ gc_mark_object(pic_state *pic, struct pic_object *obj)
} }
/* arena */ /* arena */
for (i = 0; i < cont->arena_idx; ++i) { for (i = 0; i < (size_t)cont->arena_idx; ++i) {
gc_mark_object(pic, cont->arena[i]); gc_mark_object(pic, cont->arena[i]);
} }
/* error handlers */
for (i = 0; i < cont->try_jmp_idx; ++i) {
if (cont->try_jmps[i].handler) {
gc_mark_object(pic, (struct pic_object *)cont->try_jmps[i].handler);
}
}
/* result values */ /* result values */
gc_mark(pic, cont->results); gc_mark(pic, cont->results);
break; break;
@ -578,6 +585,13 @@ gc_mark_phase(pic_state *pic)
gc_mark_object(pic, xh_val(it.e, struct pic_object *)); gc_mark_object(pic, xh_val(it.e, struct pic_object *));
} }
/* error handlers */
for (i = 0; i < pic->try_jmp_idx; ++i) {
if (pic->try_jmps[i].handler) {
gc_mark_object(pic, (struct pic_object *)pic->try_jmps[i].handler);
}
}
/* library table */ /* library table */
gc_mark(pic, pic->lib_tbl); gc_mark(pic, pic->lib_tbl);
} }