1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-04-29 19:30:36 +02:00

Use SCM_GSUBR_MAX in place of the hardcoded number

* libguile/gsubr.c (scm_apply_subr): Reference the limit.
  (get_subr_stub_code): As stated.
* libguile/jit.c (compile_subr_call): As stated.
This commit is contained in:
Daniel Llorens 2023-04-27 14:07:01 +02:00
parent 1ae50a7f80
commit fe6cc6d04a
2 changed files with 4 additions and 4 deletions

View file

@ -274,7 +274,7 @@ get_subr_stub_code (uint32_t subr_idx,
{ {
enum arity_kind kind = NULLARY; enum arity_kind kind = NULLARY;
if (SCM_UNLIKELY (rest > 1 || nreq + nopt + rest > 10)) if (SCM_UNLIKELY (rest > 1 || nreq + nopt + rest > SCM_GSUBR_MAX))
scm_out_of_range ("make-subr", scm_from_uint (nreq + nopt + rest)); scm_out_of_range ("make-subr", scm_from_uint (nreq + nopt + rest));
if (nreq) kind += REQ; if (nreq) kind += REQ;
@ -500,7 +500,7 @@ scm_apply_subr (union scm_vm_stack_element *sp, uint32_t idx, ptrdiff_t nslots)
return subr (ARG (9), ARG (8), ARG (7), ARG (6), ARG (5), return subr (ARG (9), ARG (8), ARG (7), ARG (6), ARG (5),
ARG (4), ARG (3), ARG (2), ARG (1), ARG (0)); ARG (4), ARG (3), ARG (2), ARG (1), ARG (0));
default: default:
abort (); abort (); /* SCM_GSUBR_MAX */
} }
#undef ARG #undef ARG
} }

View file

@ -1783,11 +1783,11 @@ compile_subr_call (scm_jit_state *j, uint32_t idx)
jit_gpr_t t = T0, ret = T1; jit_gpr_t t = T0, ret = T1;
void *subr; void *subr;
jit_reloc_t immediate; jit_reloc_t immediate;
jit_operand_t args[10]; jit_operand_t args[SCM_GSUBR_MAX];
ASSERT (j->frame_size_min == j->frame_size_max); ASSERT (j->frame_size_min == j->frame_size_max);
size_t argc = j->frame_size_max - 1; size_t argc = j->frame_size_max - 1;
ASSERT (argc <= 10); ASSERT (argc <= SCM_GSUBR_MAX);
subr = scm_subr_function_by_index (idx); subr = scm_subr_function_by_index (idx);
emit_store_current_ip (j, t); emit_store_current_ip (j, t);