mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-06-24 12:20:20 +02:00
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.
This commit is contained in:
parent
9fd978ed7e
commit
c86758c298
3 changed files with 90 additions and 52 deletions
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue