From 329318ae4f9c180ed68ec484bb5e1acdcb3dec44 Mon Sep 17 00:00:00 2001 From: Kaz Kylheku Date: Sat, 24 Oct 2015 19:42:30 -0700 Subject: Reduce stack usage for args in a few places. * eval.c (apply, do_eval): Use ARGS_MIN instead of ARGS_MAX. * unwind.c (uw_throw): Ditto, when invoking handler. --- eval.c | 5 ++--- unwind.c | 3 +-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/eval.c b/eval.c index 84e1265a..ea08c7b3 100644 --- a/eval.c +++ b/eval.c @@ -678,8 +678,7 @@ static val get_param_syms(val params) val apply(val fun, val arglist, val ctx_form) { - args_decl(args, ARGS_MAX); - args_init_list(args, ARGS_MAX, arglist); + args_decl_list(args, ARGS_MIN, arglist); return generic_funcall(fun, args); } @@ -1003,7 +1002,7 @@ static val do_eval(val form, val env, val ctx_form, } else { val arglist = rest(form); cnum alen = if3(consp(arglist), c_num(length(arglist)), 0); - cnum argc = max(alen, ARGS_MAX); + cnum argc = max(alen, ARGS_MIN); val ret, lfe_save = last_form_evaled; args_decl(args, argc); diff --git a/unwind.c b/unwind.c index a8df8914..79b9a7fd 100644 --- a/unwind.c +++ b/unwind.c @@ -425,8 +425,7 @@ val uw_throw(val sym, val args) if (uw_exception_subtype_p(sym, car(match))) break; if (match) { - args_decl(gf_args, ARGS_MAX); - args_init_list(gf_args, ARGS_MAX, cons(sym, args)); + args_decl_list(gf_args, ARGS_MIN, cons(sym, args)); --reentry_count; invoke_handler(ex, gf_args); ++reentry_count; -- cgit v1.2.3