summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Llorens <lloda@sarc.name>2023-04-27 14:07:01 +0200
committerDaniel Llorens <lloda@sarc.name>2023-04-27 14:07:01 +0200
commitfe6cc6d04ab094ea802907bdc4f728416c0e97ba (patch)
tree255360505318a99a2117fa3b4ec5a368a1e36c48
parent1ae50a7f80654f04d93d900e17f3160205700a75 (diff)
downloadguile-fe6cc6d04ab094ea802907bdc4f728416c0e97ba.tar.gz
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.
-rw-r--r--libguile/gsubr.c4
-rw-r--r--libguile/jit.c4
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);