shrink default arena size!
This commit is contained in:
parent
9cdca8bc70
commit
e94aaffd34
|
@ -11,7 +11,7 @@
|
||||||
#define PIC_ENABLE_READLINE 1
|
#define PIC_ENABLE_READLINE 1
|
||||||
|
|
||||||
/* initial memory size (to be dynamically extended if necessary) */
|
/* 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_HEAP_SIZE (1<<19)
|
||||||
#define PIC_STACK_SIZE 1024
|
#define PIC_STACK_SIZE 1024
|
||||||
#define PIC_IREP_SIZE 256
|
#define PIC_IREP_SIZE 256
|
||||||
|
|
|
@ -852,6 +852,7 @@ pic_codegen(pic_state *pic, pic_value obj)
|
||||||
struct pic_proc *proc;
|
struct pic_proc *proc;
|
||||||
codegen_state *state;
|
codegen_state *state;
|
||||||
jmp_buf jmp, *prev_jmp = pic->jmp;
|
jmp_buf jmp, *prev_jmp = pic->jmp;
|
||||||
|
int ai = pic_gc_arena_preserve(pic);
|
||||||
|
|
||||||
state = new_codegen_state(pic);
|
state = new_codegen_state(pic);
|
||||||
|
|
||||||
|
@ -884,6 +885,9 @@ pic_codegen(pic_state *pic, pic_value obj)
|
||||||
exit:
|
exit:
|
||||||
pic->jmp = prev_jmp;
|
pic->jmp = prev_jmp;
|
||||||
|
|
||||||
|
pic_gc_arena_restore(pic, ai);
|
||||||
|
pic_gc_protect(pic, pic_obj_value(proc));
|
||||||
|
|
||||||
return proc;
|
return proc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -103,6 +103,8 @@ expand(pic_state *pic, pic_value obj, struct syntactic_env *env)
|
||||||
assert(pic_proc_p(v));
|
assert(pic_proc_p(v));
|
||||||
define_macro(pic, pic_symbol_name(pic, pic_sym(var)), pic_proc_ptr(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();
|
return pic_false_value();
|
||||||
}
|
}
|
||||||
macro = lookup_macro(pic, env, pic_symbol_name(pic, sym));
|
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);
|
printf("macroexpand error: %s\n", pic->errmsg);
|
||||||
abort();
|
abort();
|
||||||
}
|
}
|
||||||
|
pic_gc_arena_restore(pic, ai);
|
||||||
|
pic_gc_protect(pic, v);
|
||||||
return expand(pic, v, env);
|
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)) {
|
while (! pic_nil_p(obj)) {
|
||||||
v = pic_cons(pic, expand(pic, pic_car(pic, obj), env), v);
|
v = pic_cons(pic, expand(pic, pic_car(pic, obj), env), v);
|
||||||
obj = pic_cdr(pic, obj);
|
obj = pic_cdr(pic, obj);
|
||||||
|
|
||||||
|
pic_gc_arena_restore(pic, ai);
|
||||||
|
pic_gc_protect(pic, v);
|
||||||
}
|
}
|
||||||
v = pic_reverse(pic, v);
|
v = pic_reverse(pic, v);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue