shrink default arena size!

This commit is contained in:
Yuichi Nishiwaki 2013-11-15 19:54:47 +09:00
parent 9cdca8bc70
commit e94aaffd34
3 changed files with 12 additions and 1 deletions

View File

@ -11,7 +11,7 @@
#define PIC_ENABLE_READLINE 1
/* initial memory size (to be dynamically extended if necessary) */
#define PIC_ARENA_SIZE 10000
#define PIC_ARENA_SIZE 100
#define PIC_HEAP_SIZE (1<<19)
#define PIC_STACK_SIZE 1024
#define PIC_IREP_SIZE 256

View File

@ -852,6 +852,7 @@ pic_codegen(pic_state *pic, pic_value obj)
struct pic_proc *proc;
codegen_state *state;
jmp_buf jmp, *prev_jmp = pic->jmp;
int ai = pic_gc_arena_preserve(pic);
state = new_codegen_state(pic);
@ -884,6 +885,9 @@ pic_codegen(pic_state *pic, pic_value obj)
exit:
pic->jmp = prev_jmp;
pic_gc_arena_restore(pic, ai);
pic_gc_protect(pic, pic_obj_value(proc));
return proc;
}

View File

@ -103,6 +103,8 @@ expand(pic_state *pic, pic_value obj, struct syntactic_env *env)
assert(pic_proc_p(v));
define_macro(pic, pic_symbol_name(pic, pic_sym(var)), pic_proc_ptr(v));
pic_gc_arena_restore(pic, ai);
pic_gc_protect(pic, v);
return pic_false_value();
}
macro = lookup_macro(pic, env, pic_symbol_name(pic, sym));
@ -112,6 +114,8 @@ expand(pic_state *pic, pic_value obj, struct syntactic_env *env)
printf("macroexpand error: %s\n", pic->errmsg);
abort();
}
pic_gc_arena_restore(pic, ai);
pic_gc_protect(pic, v);
return expand(pic, v, env);
}
}
@ -120,6 +124,9 @@ expand(pic_state *pic, pic_value obj, struct syntactic_env *env)
while (! pic_nil_p(obj)) {
v = pic_cons(pic, expand(pic, pic_car(pic, obj), env), v);
obj = pic_cdr(pic, obj);
pic_gc_arena_restore(pic, ai);
pic_gc_protect(pic, v);
}
v = pic_reverse(pic, v);