diff --git a/test/-ext-/debug/test_debug.rb b/test/-ext-/debug/test_debug.rb index 8a351d74fa..a6e0af2314 100644 --- a/test/-ext-/debug/test_debug.rb +++ b/test/-ext-/debug/test_debug.rb @@ -72,4 +72,19 @@ class TestDebug < Test::Unit::TestCase 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 diff --git a/version.h b/version.h index 3b8d50b4bf..d5294f759c 100644 --- a/version.h +++ b/version.h @@ -11,7 +11,7 @@ # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 8 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 155 +#define RUBY_PATCHLEVEL 156 #include "ruby/version.h" #include "ruby/internal/abi.h" diff --git a/yjit/src/codegen.rs b/yjit/src/codegen.rs index d702b1133e..168d870078 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -7449,7 +7449,6 @@ fn gen_send_general( } OPTIMIZED_METHOD_TYPE_CALL => { - if block.is_some() { gen_counter_incr(asm, Counter::send_call_block); return None; @@ -7501,8 +7500,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(asm, Counter::send_optimized_method_block_call);