mirror of
https://github.com/ashinn/chibi-scheme.git
synced 2025-07-09 05:57:36 +02:00
fixing non-tail-call optimization in some conditional cases
This commit is contained in:
parent
3087302be6
commit
b77d102a70
2 changed files with 15 additions and 0 deletions
13
eval.c
13
eval.c
|
@ -837,6 +837,7 @@ static void generate_cnd (sexp ctx, sexp cnd) {
|
|||
sexp_context_depth(ctx)--;
|
||||
label1 = sexp_context_make_label(ctx);
|
||||
generate(ctx, sexp_cnd_pass(cnd));
|
||||
sexp_context_tailp(ctx) = tailp;
|
||||
emit(ctx, SEXP_OP_JUMP);
|
||||
sexp_context_depth(ctx)--;
|
||||
label2 = sexp_context_make_label(ctx);
|
||||
|
@ -2354,6 +2355,18 @@ sexp sexp_define_foreign_aux (sexp ctx, sexp env, char *name, int num_args,
|
|||
return res;
|
||||
}
|
||||
|
||||
sexp sexp_define_foreign_param (sexp ctx, sexp env, char *name, int num_args,
|
||||
sexp_proc1 f, char *param) {
|
||||
sexp res;
|
||||
sexp_gc_var1(tmp);
|
||||
sexp_gc_preserve1(ctx, tmp);
|
||||
tmp = sexp_intern(ctx, param);
|
||||
tmp = sexp_env_cell(env, tmp);
|
||||
res = sexp_define_foreign_aux(ctx, env, name, num_args, 3, f, tmp);
|
||||
sexp_gc_release1(ctx);
|
||||
return res;
|
||||
}
|
||||
|
||||
#if SEXP_USE_TYPE_DEFS
|
||||
|
||||
sexp sexp_make_type_predicate (sexp ctx, sexp name, sexp type) {
|
||||
|
|
|
@ -152,6 +152,8 @@ SEXP_API sexp sexp_define_foreign_aux (sexp ctx, sexp env, char *name, int num_a
|
|||
#define sexp_define_foreign(c,e,s,n,f) sexp_define_foreign_aux(c,e,s,n,0,(sexp_proc1)f,NULL)
|
||||
#define sexp_define_foreign_opt(c,e,s,n,f,d) sexp_define_foreign_aux(c,e,s,n,1,(sexp_proc1)f,d)
|
||||
|
||||
SEXP_API sexp sexp_define_foreign_param (sexp ctx, sexp env, char *name, int num_args, sexp_proc1 f, char *param);
|
||||
|
||||
#if SEXP_USE_TYPE_DEFS
|
||||
SEXP_API sexp sexp_make_type_predicate (sexp ctx, sexp name, sexp type);
|
||||
SEXP_API sexp sexp_make_constructor (sexp ctx, sexp name, sexp type);
|
||||
|
|
Loading…
Add table
Reference in a new issue