Skip to content

Commit

Permalink
RJIT: Properly reject keyword splat with yield
Browse files Browse the repository at this point in the history
See the fix for YJIT.
  • Loading branch information
XrXr committed Jan 19, 2024
1 parent 9866512 commit 0d6708c
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/ruby_vm/rjit/insn_compiler.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4452,6 +4452,11 @@ def jit_call_iseq(jit, ctx, asm, cme, calling, iseq, frame_type: nil, prev_ep: n
return CantCompile
end

if flags & C::VM_CALL_KW_SPLAT != 0
asm.incr_counter(:send_iseq_kw_splat)
return CantCompile
end

if iseq_has_rest && opt_num != 0
asm.incr_counter(:send_iseq_has_rest_and_optional)
return CantCompile
Expand Down
1 change: 1 addition & 0 deletions rjit_c.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ RJIT_RUNTIME_COUNTERS(
send_iseq_has_rest,
send_iseq_block_arg0_splat,
send_iseq_kw_call,
send_iseq_kw_splat,
send_iseq_splat,
send_iseq_has_rest_and_optional,
send_iseq_arity_error,
Expand Down
1 change: 1 addition & 0 deletions rjit_c.rb
Original file line number Diff line number Diff line change
Expand Up @@ -1388,6 +1388,7 @@ def C.rb_rjit_runtime_counters
send_iseq_has_rest: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_has_rest)")],
send_iseq_block_arg0_splat: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_block_arg0_splat)")],
send_iseq_kw_call: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_kw_call)")],
send_iseq_kw_splat: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_kw_splat)")],
send_iseq_splat: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_splat)")],
send_iseq_has_rest_and_optional: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_has_rest_and_optional)")],
send_iseq_arity_error: [CType::Immediate.parse("size_t"), Primitive.cexpr!("OFFSETOF((*((struct rb_rjit_runtime_counters *)NULL)), send_iseq_arity_error)")],
Expand Down

0 comments on commit 0d6708c

Please sign in to comment.