Skip to content
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
15 changes: 15 additions & 0 deletions test/-ext-/debug/test_debug.rb
Original file line number Diff line number Diff line change
Expand Up @@ -75,4 +75,19 @@ def test_lazy_block
end
assert_equal true, x, '[Bug #15105]'
end

# This is a YJIT test, but we can't test this without a C extension that calls
# rb_debug_inspector_open(), so we're testing it using "-test-/debug" here.
def test_yjit_invalidates_setlocal_after_inspector_call
val = setlocal_after_proc_call(proc { Bug::Debug.inspector; :ok })
assert_equal :ok, val
end if defined?(RubyVM::YJIT) && RubyVM::YJIT.enabled?

private

def setlocal_after_proc_call(block)
local = block.call # setlocal followed by OPTIMIZED_METHOD_TYPE_CALL
itself # split a block using a C call
local # getlocal
end
end
4 changes: 2 additions & 2 deletions yjit/src/codegen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9375,7 +9375,6 @@ fn gen_send_general(

}
OPTIMIZED_METHOD_TYPE_CALL => {

if block.is_some() {
gen_counter_incr(jit, asm, Counter::send_call_block);
return None;
Expand Down Expand Up @@ -9427,8 +9426,9 @@ fn gen_send_general(

let stack_ret = asm.stack_push(Type::Unknown);
asm.mov(stack_ret, ret);
return Some(KeepCompiling);

// End the block to allow invalidating the next instruction
return jump_to_next_insn(jit, asm);
}
OPTIMIZED_METHOD_TYPE_BLOCK_CALL => {
gen_counter_incr(jit, asm, Counter::send_optimized_method_block_call);
Expand Down
Loading