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:
Matthew Flatt 2011-12-13 15:32:22 -07:00
parent d312744aae
commit f7c506471b
3 changed files with 8 additions and 18 deletions

View File

@ -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. */

View File

@ -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)) {
/* 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);
}
/* Try the next one... */
}

View File

@ -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 */