mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-05-21 14:49:18 +02:00
recursive evals now share the same stack.
since in a minimal chibi heap the stack accounts for a large amount of the space, this makes a big difference - you can now load (chibi match) in a 2MB heap on a 64-bit system and it won't grow the heap.
This commit is contained in:
parent
7392e082cc
commit
8596e1812a
2 changed files with 8 additions and 6 deletions
7
TODO
7
TODO
|
@ -9,11 +9,8 @@
|
|||
- State "DONE" [2009-04-09 Thu 14:45]
|
||||
** TODO native x86 backend
|
||||
** TODO fasl/image files
|
||||
** TODO shared stack on EVAL
|
||||
Arguably a bug, at the moment we create a new stack on every EVAL
|
||||
(which includes every macro definition, and in particular every
|
||||
call to let-syntax that a macro may expand into - I'm looking at
|
||||
you, (chibi loop)).
|
||||
** DONE shared stack on EVAL
|
||||
- State "DONE" [2009-12-26 Sat 08:22]
|
||||
|
||||
* compiler optimizations
|
||||
** DONE constant folding
|
||||
|
|
7
eval.c
7
eval.c
|
@ -2653,13 +2653,18 @@ sexp sexp_compile (sexp ctx, sexp x) {
|
|||
}
|
||||
|
||||
sexp sexp_eval (sexp ctx, sexp obj, sexp env) {
|
||||
sexp_sint_t top;
|
||||
sexp ctx2;
|
||||
sexp_gc_var1(res);
|
||||
sexp_gc_preserve1(ctx, res);
|
||||
ctx2 = sexp_make_eval_context(ctx, NULL, (env ? env : sexp_context_env(ctx)));
|
||||
top = sexp_context_top(ctx);
|
||||
ctx2 = sexp_make_eval_context(ctx,
|
||||
sexp_context_stack(ctx),
|
||||
(env ? env : sexp_context_env(ctx)));
|
||||
res = sexp_compile(ctx2, obj);
|
||||
if (! sexp_exceptionp(res))
|
||||
res = sexp_apply(ctx2, res, SEXP_NULL);
|
||||
sexp_context_top(ctx) = top;
|
||||
sexp_gc_release1(ctx);
|
||||
return res;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue