gc management

This commit is contained in:
Yuichi Nishiwaki 2014-01-27 22:20:18 +09:00
parent 8343ccd675
commit 8255e11486
1 changed files with 5 additions and 0 deletions

View File

@ -874,9 +874,14 @@ resolve_reference_node(resolver_state *state, pic_value obj)
return obj; return obj;
} }
else { else {
int ai = pic_gc_arena_preserve(pic);
pic_value seq = pic_list(pic, 1, pic_symbol_value(tag)); pic_value seq = pic_list(pic, 1, pic_symbol_value(tag));
for (obj = pic_cdr(pic, obj); ! pic_nil_p(obj); obj = pic_cdr(pic, obj)) { for (obj = pic_cdr(pic, obj); ! pic_nil_p(obj); obj = pic_cdr(pic, obj)) {
seq = pic_cons(pic, resolve_reference(state, pic_car(pic, obj)), seq); seq = pic_cons(pic, resolve_reference(state, pic_car(pic, obj)), seq);
pic_gc_arena_restore(pic, ai);
pic_gc_protect(pic, obj);
pic_gc_protect(pic, seq);
} }
return pic_reverse(pic, seq); return pic_reverse(pic, seq);
} }