JIT: fix problem with arity checking with >= 25 arguments
This commit is contained in:
parent
f99d6840a6
commit
cddfdca835
|
@ -112,6 +112,13 @@
|
||||||
(syntax-test #'(lambda (x . 5) x))
|
(syntax-test #'(lambda (x . 5) x))
|
||||||
(syntax-test #'(lambda (x) x . 5))
|
(syntax-test #'(lambda (x) x . 5))
|
||||||
|
|
||||||
|
;; 25 is a threshold for non-shared arity-handling code:
|
||||||
|
(module check-wrong-arity-many-arguments racket/base
|
||||||
|
((lambda (a b c d e f g h i j k l m n o p q r s t u v w x y)
|
||||||
|
1)))
|
||||||
|
(err/rt-test (dynamic-require ''check-wrong-arity-many-arguments #f)
|
||||||
|
exn:fail:contract:arity?)
|
||||||
|
|
||||||
(err/rt-test (letrec ([not-ready not-ready]) 5)
|
(err/rt-test (letrec ([not-ready not-ready]) 5)
|
||||||
(lambda (exn)
|
(lambda (exn)
|
||||||
(and (exn:fail:contract:variable? exn)
|
(and (exn:fail:contract:variable? exn)
|
||||||
|
|
|
@ -3293,7 +3293,7 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data)
|
||||||
{
|
{
|
||||||
Generate_Closure_Data *gdata = (Generate_Closure_Data *)_data;
|
Generate_Closure_Data *gdata = (Generate_Closure_Data *)_data;
|
||||||
Scheme_Closure_Data *data = gdata->data;
|
Scheme_Closure_Data *data = gdata->data;
|
||||||
void *start_code, *tail_code, *code_end, *arity_code;
|
void *start_code, *tail_code, *code_end, *arity_code, *do_arity_code;
|
||||||
#ifdef NEED_RETAIN_CODE_POINTERS
|
#ifdef NEED_RETAIN_CODE_POINTERS
|
||||||
void *retain_code = NULL;
|
void *retain_code = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
@ -3340,10 +3340,7 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data)
|
||||||
|
|
||||||
arity_code = jit_get_ip();
|
arity_code = jit_get_ip();
|
||||||
|
|
||||||
if (!has_rest)
|
do_arity_code = shared_arity_code;
|
||||||
(void)jit_bnei_i(shared_arity_code, JIT_R1, num_params);
|
|
||||||
else
|
|
||||||
(void)jit_blti_i(shared_arity_code, JIT_R1, num_params);
|
|
||||||
} else {
|
} else {
|
||||||
arity_code = generate_lambda_simple_arity_check(num_params, has_rest, is_method, 0);
|
arity_code = generate_lambda_simple_arity_check(num_params, has_rest, is_method, 0);
|
||||||
#ifdef NEED_RETAIN_CODE_POINTERS
|
#ifdef NEED_RETAIN_CODE_POINTERS
|
||||||
|
@ -3352,8 +3349,15 @@ static int do_generate_closure(mz_jit_state *jitter, void *_data)
|
||||||
#endif
|
#endif
|
||||||
arity_code = jit_adjust_ip(arity_code);
|
arity_code = jit_adjust_ip(arity_code);
|
||||||
CHECK_NESTED_GENERATE();
|
CHECK_NESTED_GENERATE();
|
||||||
|
|
||||||
|
do_arity_code = arity_code;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!has_rest)
|
||||||
|
(void)jit_bnei_i(do_arity_code, JIT_R1, num_params);
|
||||||
|
else
|
||||||
|
(void)jit_blti_i(do_arity_code, JIT_R1, num_params);
|
||||||
|
|
||||||
/* A tail call starts here. Caller must ensure that the stack is big
|
/* A tail call starts here. Caller must ensure that the stack is big
|
||||||
enough, right number of arguments (at start of runstack), closure
|
enough, right number of arguments (at start of runstack), closure
|
||||||
is in R0. If the closure has a rest arg, also ensure argc in R1
|
is in R0. If the closure has a rest arg, also ensure argc in R1
|
||||||
|
|
Loading…
Reference in New Issue
Block a user