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