[YJIT] Don't expand kwargs on forwarding

Similarly to splat arrays, we shouldn't expand splat kwargs.

[ruby-core:118401]
This commit is contained in:
Aaron Patterson 2024-06-28 15:23:14 -04:00 committed by Aaron Patterson
parent 9930647134
commit a2c27bae96
2 changed files with 21 additions and 1 deletions

View File

@ -5121,3 +5121,23 @@ assert_equal 'ok', <<~'RUBY'
ok(["ok"], ->(x) { x }) ok(["ok"], ->(x) { x })
RUBY RUBY
assert_equal 'ok', <<~'RUBY'
def baz(a, b)
a + b
end
def bar(...)
baz(...)
end
def foo(a, ...)
bar(a, ...)
end
def test
foo("o", "k")
end
test
RUBY

View File

@ -6962,7 +6962,6 @@ fn gen_send_iseq(
let iseq_has_rest = unsafe { get_iseq_flags_has_rest(iseq) }; let iseq_has_rest = unsafe { get_iseq_flags_has_rest(iseq) };
let iseq_has_block_param = unsafe { get_iseq_flags_has_block(iseq) }; let iseq_has_block_param = unsafe { get_iseq_flags_has_block(iseq) };
let arg_setup_block = captured_opnd.is_some(); // arg_setup_type: arg_setup_block (invokeblock) let arg_setup_block = captured_opnd.is_some(); // arg_setup_type: arg_setup_block (invokeblock)
let kw_splat = flags & VM_CALL_KW_SPLAT != 0;
// Is this iseq tagged as "forwardable"? Iseqs that take `...` as a // Is this iseq tagged as "forwardable"? Iseqs that take `...` as a
// parameter are tagged as forwardable (e.g. `def foo(...); end`) // parameter are tagged as forwardable (e.g. `def foo(...); end`)
@ -6975,6 +6974,7 @@ fn gen_send_iseq(
// //
// `def foo(...); end; foo(*blah)` // `def foo(...); end; foo(*blah)`
let splat_call = (flags & VM_CALL_ARGS_SPLAT != 0) && !forwarding; let splat_call = (flags & VM_CALL_ARGS_SPLAT != 0) && !forwarding;
let kw_splat = (flags & VM_CALL_KW_SPLAT != 0) && !forwarding;
// For computing offsets to callee locals // For computing offsets to callee locals
let num_params = unsafe { get_iseq_body_param_size(iseq) as i32 }; let num_params = unsafe { get_iseq_body_param_size(iseq) as i32 };