more arena freeing during compilation
This commit is contained in:
parent
bda1b93ec2
commit
e5f7eda432
|
@ -1360,6 +1360,8 @@ pic_codegen(pic_state *pic, pic_value obj)
|
||||||
return codegen_context_destroy(pic, cxt);
|
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 *
|
struct pic_proc *
|
||||||
pic_compile(pic_state *pic, pic_value obj, struct pic_env *env)
|
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));
|
fprintf(stdout, "ai = %zu\n", pic_gc_arena_preserve(pic));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SAVE(pic, ai, obj);
|
||||||
|
|
||||||
/* analyze */
|
/* analyze */
|
||||||
obj = pic_analyze(pic, obj);
|
obj = pic_analyze(pic, obj);
|
||||||
#if DEBUG
|
#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));
|
fprintf(stdout, "ai = %zu\n", pic_gc_arena_preserve(pic));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
SAVE(pic, ai, obj);
|
||||||
|
|
||||||
/* codegen */
|
/* codegen */
|
||||||
irep = pic_codegen(pic, obj);
|
irep = pic_codegen(pic, obj);
|
||||||
#if DEBUG
|
#if DEBUG
|
||||||
|
@ -1406,8 +1412,7 @@ pic_compile(pic_state *pic, pic_value obj, struct pic_env *env)
|
||||||
puts("");
|
puts("");
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
pic_gc_arena_restore(pic, ai);
|
SAVE(pic, ai, pic_obj_value(irep));
|
||||||
pic_gc_protect(pic, pic_obj_value(irep));
|
|
||||||
|
|
||||||
return pic_make_proc_irep(pic, irep, NULL);
|
return pic_make_proc_irep(pic, irep, NULL);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue