diff options
author | Andy Wingo <wingo@pobox.com> | 2019-06-06 17:26:59 +0200 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2019-06-06 17:26:59 +0200 |
commit | c86758c298fdd06456939d16d604f9ff9a6c7b10 (patch) | |
tree | 9094978f6b462bc8141a17d5ab308645d9657a0c /libguile/programs.c | |
parent | 9fd978ed7eebe32ceff7762eb87bba5d56a0743c (diff) | |
download | guile-c86758c298fdd06456939d16d604f9ff9a6c7b10.tar.gz |
Allow for bind-optionals without alloc-frame
This reduces subr trampoline instruction count for subrs with optional
args.
* libguile/gsubr.c (get_subr_stub_code): Insert bind-optionals
instructions.
(primitive_call_ip): Handle bind-optionals.
* libguile/programs.c (try_parse_arity): Handle bind-optionals.
* libguile/jit.c (struct scm_jit_state)
(compile_call, compile_call_label, compile_tail_call)
(compile_tail_call_label, compile_receive), compile_receive_values)
(compile_shuffle_down, compile_return_values, compile_subr_call)
(compile_foreign_call, compile_continuation_call)
(compile_compose_continuation, compile_abort, compile_assert_nargs_ee)
(compile_assert_nargs_ge, compile_assert_nargs_le)
(compile_alloc_frame, compile_reset_frame, compile_push)
(compile_pop, compile_drop, compile_expand_apply_argument)
(compile_bind_kwargs, compile_bind_rest, compile_bind_optionals)
(compile, compute_mcode): Separately track min and max frame sizes.
Diffstat (limited to 'libguile/programs.c')
-rw-r--r-- | libguile/programs.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/libguile/programs.c b/libguile/programs.c index 675035727..81495a5b1 100644 --- a/libguile/programs.c +++ b/libguile/programs.c @@ -295,6 +295,12 @@ try_parse_arity (SCM program, int *req, int *opt, int *rest) *opt = slots - 1; *rest = 0; return 1; + case scm_op_bind_optionals: + slots = code[0] >> 8; + *req = 0; + *opt = slots - 1; + *rest = ((code[1] & 0xff) == scm_op_bind_rest); + return 1; case scm_op_bind_rest: slots = code[0] >> 8; *req = 0; @@ -310,6 +316,12 @@ try_parse_arity (SCM program, int *req, int *opt, int *rest) *opt = slots - 1 - *req; *rest = 0; return 1; + case scm_op_bind_optionals: + slots = code[1] >> 8; + *req = min - 1; + *opt = slots - 1 - *req; + *rest = ((code[2] & 0xff) == scm_op_bind_rest); + return 1; case scm_op_bind_rest: slots = code[1] >> 8; *req = min - 1; |