10000 merge revision(s) bbd249e351af7e4929b518a5de73a832b5617273: [Backport #20192] by nurse · Pull Request #10249 · ruby/ruby · GitHub
[go: up one dir, main page]

Skip to content

merge revision(s) bbd249e351af7e4929b518a5de73a832b5617273: [Backport #20192] #10249

New issue

Have a question about thi 10000 s project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
May 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions bootstraptest/test_yjit.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,13 @@ def call_foo
call_foo
}

# regression test for keyword splat with yield
assert_equal 'nil', %q{
def splat_kw(kwargs) = yield(**kwargs)

splat_kw({}) { _1 }.inspect
} unless rjit_enabled? # Not yet working on RJIT

# regression test for arity check with splat
assert_equal '[:ae, :ae]', %q{
def req_one(a_, b_ = 1) = raise
Expand Down
9 changes: 9 additions & 0 deletions yjit/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6009,6 +6009,7 @@ fn gen_send_iseq(
exit_if_tail_call(asm, ci)?;
exit_if_has_post(asm, iseq)?;
exit_if_has_kwrest(asm, iseq)?;
exit_if_kw_splat(asm, flags)?;
exit_if_splat_and_ruby2_keywords(asm, jit, flags)?;
exit_if_has_rest_and_captured(asm, iseq_has_rest, captured_opnd)?;
exit_if_has_rest_and_supplying_kws(asm, iseq_has_rest, iseq, supplying_kws)?;
Expand Down Expand Up @@ -6139,6 +6140,9 @@ fn gen_send_iseq(
let array = jit.peek_at_stack(&asm.ctx, if block_arg { 1 } else { 0 }) ;
let array_length = if array == Qnil {
0
} else if unsafe { !RB_TYPE_P(array, RUBY_T_ARRAY) } {
gen_counter_incr(asm, Counter::send_iseq_splat_not_array);
return None;
} else {
unsafe { rb_yjit_array_len(array) as u32}
};
Expand Down Expand Up @@ -6820,6 +6824,11 @@ fn exit_if_has_kwrest(asm: &mut Assembler, iseq: *const rb_iseq_t) -> Option<()>
exit_if(asm, unsafe { get_iseq_flags_has_kwrest(iseq) }, Counter::send_iseq_has_kwrest)
}

#[must_use]
fn exit_if_kw_splat(asm: &mut Assembler, flags: u32) -> Option<()> {
exit_if(asm, flags & VM_CALL_KW_SPLAT != 0, Counter::send_iseq_kw_splat)
}

#[must_use]
fn exit_if_splat_and_ruby2_keywords(asm: &mut Assembler, jit: &mut JITState, flags: u32) -> Option<()> {
// In order to handle backwards compatibility between ruby 3 and 2
Expand Down
2 changes: 2 additions & 0 deletions yjit/src/stats.rs
Original file line number Diff line number Diff line change
Expand Up @@ -331,13 +331,15 @@ make_counters! {
send_iseq_clobbering_block_arg,
send_iseq_leaf_builtin_block_arg_block_param,
send_iseq_only_keywords,
send_iseq_kw_splat,
send_iseq_kwargs_req_and_opt_missing,
send_iseq_kwargs_mismatch,
send_iseq_has_post,
send_iseq_has_kwrest,
send_iseq_has_no_kw,
send_iseq_accepts_no_kwarg,
send_iseq_materialized_block,
send_iseq_splat_not_array,
send_iseq_splat_with_opt,
send_iseq_splat_with_kw,
send_iseq_missing_optional_kw,
Expand Down
Loading
0