From e5f7eda432acb46f85a164e1783fb2e802204452 Mon Sep 17 00:00:00 2001 From: Yuichi Nishiwaki Date: Sun, 28 Jun 2015 01:51:20 +0900 Subject: [PATCH] more arena freeing during compilation --- extlib/benz/codegen.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/extlib/benz/codegen.c b/extlib/benz/codegen.c index 9516afa0..de66aed5 100644 --- a/extlib/benz/codegen.c +++ b/extlib/benz/codegen.c @@ -1360,6 +1360,8 @@ pic_codegen(pic_state *pic, pic_value obj) return codegen_context_destroy(pic, cxt); } +#define SAVE(pic, ai, obj) pic_gc_arena_restore(pic, ai); pic_gc_protect(pic, obj) + struct pic_proc * pic_compile(pic_state *pic, pic_value obj, struct pic_env *env) { @@ -1385,6 +1387,8 @@ pic_compile(pic_state *pic, pic_value obj, struct pic_env *env) fprintf(stdout, "ai = %zu\n", pic_gc_arena_preserve(pic)); #endif + SAVE(pic, ai, obj); + /* analyze */ obj = pic_analyze(pic, obj); #if DEBUG @@ -1394,6 +1398,8 @@ pic_compile(pic_state *pic, pic_value obj, struct pic_env *env) fprintf(stdout, "ai = %zu\n", pic_gc_arena_preserve(pic)); #endif + SAVE(pic, ai, obj); + /* codegen */ irep = pic_codegen(pic, obj); #if DEBUG @@ -1406,8 +1412,7 @@ pic_compile(pic_state *pic, pic_value obj, struct pic_env *env) puts(""); #endif - pic_gc_arena_restore(pic, ai); - pic_gc_protect(pic, pic_obj_value(irep)); + SAVE(pic, ai, pic_obj_value(irep)); return pic_make_proc_irep(pic, irep, NULL); }