From 52927ac45215474efafa12b52ca05d8318244936 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Mon, 27 Jan 2014 21:17:24 +0900 Subject: [PATCH] gc resolver --- src/codegen.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/codegen.c b/src/codegen.c index b3af1251..63951f18 100644 --- a/src/codegen.c +++ b/src/codegen.c @@ -816,8 +816,22 @@ resolve_cref(resolver_state *state, int depth, pic_sym sym) pic_int_value(i)); } +static pic_value resolve_reference_node(resolver_state *state, pic_value obj); + static pic_value resolve_reference(resolver_state *state, pic_value obj) +{ + int ai = pic_gc_arena_preserve(state->pic); + + obj = resolve_reference_node(state, obj); + + pic_gc_arena_restore(state->pic, ai); + pic_gc_protect(state->pic, obj); + return obj; +} + +static pic_value +resolve_reference_node(resolver_state *state, pic_value obj) { pic_state *pic = state->pic; resolver_scope *scope = state->scope;