remove redundant arity checking calling JIT-generated code
JIT-generated code has arity checking built in, but the interpreter-to-JIT path unnecessarily checked arity before jumping to JITted code.
This commit is contained in:
parent
d312744aae
commit
f7c506471b
|
@ -2763,12 +2763,6 @@ scheme_do_eval(Scheme_Object *obj, int num_rands, Scheme_Object **rands,
|
|||
|
||||
DO_CHECK_FOR_BREAK(p, );
|
||||
|
||||
if (!scheme_native_arity_check(obj, num_rands)) {
|
||||
scheme_wrong_count_m((const char *)obj, -1, -1,
|
||||
num_rands, rands, 0);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
data = ((Scheme_Native_Closure *)obj)->code;
|
||||
|
||||
/* Enlarge the runstack? This max_let_depth is in bytes instead of words. */
|
||||
|
|
|
@ -3678,14 +3678,11 @@ static int generate_case_lambda_dispatch(mz_jit_state *jitter, Scheme_Case_Lambd
|
|||
if (has_rest && num_params)
|
||||
--num_params;
|
||||
|
||||
/* Check for arity match - not needed in getarg mode if this
|
||||
is the last case, since the arity check as already done. */
|
||||
if (!do_getarg || (i < cnt - 1)) {
|
||||
if (!has_rest)
|
||||
ref = jit_bnei_i(jit_forward(), JIT_R1, num_params);
|
||||
else
|
||||
ref = jit_blti_i(jit_forward(), JIT_R1, num_params);
|
||||
}
|
||||
/* Check for arity match. */
|
||||
if (!has_rest)
|
||||
ref = jit_bnei_i(jit_forward(), JIT_R1, num_params);
|
||||
else
|
||||
ref = jit_blti_i(jit_forward(), JIT_R1, num_params);
|
||||
|
||||
/* Function-argument handling for this case: */
|
||||
if (do_getarg) {
|
||||
|
@ -3701,9 +3698,7 @@ static int generate_case_lambda_dispatch(mz_jit_state *jitter, Scheme_Case_Lambd
|
|||
jit_jmpr(JIT_V1);
|
||||
CHECK_LIMIT();
|
||||
|
||||
if (!do_getarg || (i < cnt - 1)) {
|
||||
mz_patch_branch(ref);
|
||||
}
|
||||
mz_patch_branch(ref);
|
||||
/* Try the next one... */
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,8 @@ static jit_insn *generate_proc_struct_retry(mz_jit_state *jitter, int num_rands,
|
|||
CHECK_LIMIT();
|
||||
|
||||
/* It's a native closure, but we can't just jump to it, in case
|
||||
the arity is wrong. */
|
||||
the arity is wrong and an error needs to be reported using
|
||||
the original wrapper. */
|
||||
mz_prepare(2);
|
||||
jit_movi_i(JIT_R0, num_rands);
|
||||
jit_pusharg_i(JIT_R0); /* argc */
|
||||
|
|
Loading…
Reference in New Issue
Block a user