From fe6cc6d04ab094ea802907bdc4f728416c0e97ba Mon Sep 17 00:00:00 2001 From: Daniel Llorens Date: Thu, 27 Apr 2023 14:07:01 +0200 Subject: 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. --- libguile/gsubr.c | 4 ++-- libguile/jit.c | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/libguile/gsubr.c b/libguile/gsubr.c index 644262737..a33cbb9c4 100644 --- a/libguile/gsubr.c +++ b/libguile/gsubr.c @@ -274,7 +274,7 @@ get_subr_stub_code (uint32_t subr_idx, { 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)); 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), ARG (4), ARG (3), ARG (2), ARG (1), ARG (0)); default: - abort (); + abort (); /* SCM_GSUBR_MAX */ } #undef ARG } diff --git a/libguile/jit.c b/libguile/jit.c index 5cef8fae3..515882740 100644 --- a/libguile/jit.c +++ b/libguile/jit.c @@ -1783,11 +1783,11 @@ compile_subr_call (scm_jit_state *j, uint32_t idx) jit_gpr_t t = T0, ret = T1; void *subr; 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); size_t argc = j->frame_size_max - 1; - ASSERT (argc <= 10); + ASSERT (argc <= SCM_GSUBR_MAX); subr = scm_subr_function_by_index (idx); emit_store_current_ip (j, t); -- cgit v1.2.1