@@ -1891,7 +1891,22 @@ gen_return_branch(codeblock_t* cb, uint8_t* target0, uint8_t* target1, uint8_t s
1891
1891
}
1892
1892
}
1893
1893
1894
- bool rb_simple_iseq_p (const rb_iseq_t * iseq );
1894
+ // Returns whether the iseq only needs positional (lead) argument setup.
1895
+ static bool
1896
+ iseq_lead_only_arg_setup_p (const rb_iseq_t * iseq )
1897
+ {
1898
+ // When iseq->body->local_iseq == iseq, setup_parameters_complex()
1899
+ // doesn't do anything to setup the block parameter.
1900
+ bool takes_block = iseq -> body -> param .flags .has_block ;
1901
+ return (!takes_block || iseq -> body -> local_iseq == iseq ) &&
1902
+ iseq -> body -> param .flags .has_opt == false &&
1903
+ iseq -> body -> param .flags .has_rest == false &&
1904
+ iseq -> body -> param .flags .has_post == false &&
1905
+ iseq -> body -> param .flags .has_kw == false &&
1906
+ iseq -> body -> param .flags .has_kwrest == false &&
1907
+ iseq -> body -> param .flags .accepts_no_kwarg == false;
1908
+ }
1909
+
1895
1910
bool rb_iseq_only_optparam_p (const rb_iseq_t * iseq );
1896
1911
bool rb_iseq_only_kwparam_p (const rb_iseq_t * iseq );
1897
1912
@@ -1909,7 +1924,9 @@ gen_send_iseq(jitstate_t *jit, ctx_t *ctx, const struct rb_callinfo *ci, const r
1909
1924
// Arity handling and optional parameter setup
1910
1925
int num_params = iseq -> body -> param .size ;
1911
1926
uint32_t start_pc_offset = 0 ;
1912
- if (rb_simple_iseq_p (iseq )) {
1927
+ if (iseq_lead_only_arg_setup_p (iseq )) {
1928
+ num_params = iseq -> body -> param .lead_num ;
1929
+
1913
1930
if (num_params != argc ) {
1914
1931
GEN_COUNTER_INC (cb , send_iseq_arity_error );
1915
1932
return YJIT_CANT_COMPILE ;
0 commit comments