diff options
| author | Takashi Kokubun <takashikkbn@gmail.com> | 2025-05-05 13:35:28 -0700 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-05-05 13:35:28 -0700 |
| commit | cbf9c088f8005a49b6aa3f475c70041357774c61 (patch) | |
| tree | aac153d1a17f29fb65061bf73fc35e9a35c5b2b3 | |
| parent | 4621feb677b1f1f490e675bc122cf7cffd1a3da1 (diff) | |
YJIT: End the block after OPTIMIZE_METHOD_TYPE_CALL (#13245)
Notes
Notes:
Merged-By: k0kubun <takashikkbn@gmail.com>
| -rw-r--r-- | test/-ext-/debug/test_debug.rb | 15 | ||||
| -rw-r--r-- | yjit/src/codegen.rs | 4 |
2 files changed, 17 insertions, 2 deletions
diff --git a/test/-ext-/debug/test_debug.rb b/test/-ext-/debug/test_debug.rb index 98e178e34f..2229859801 100644 --- a/test/-ext-/debug/test_debug.rb +++ b/test/-ext-/debug/test_debug.rb @@ -75,4 +75,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/yjit/src/codegen.rs b/yjit/src/codegen.rs index 0d74f2a3fb..c58917a0bf 100644 --- a/yjit/src/codegen.rs +++ b/yjit/src/codegen.rs @@ -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; @@ -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); |
