From 5576da7900162234c8e114b72401a8e0681c7c61 Mon Sep 17 00:00:00 2001 From: Takashi Kokubun Date: Fri, 24 Feb 2023 14:38:22 -0800 Subject: [PATCH] Re-compile MJIT entry on constant IC update --- lib/ruby_vm/mjit/compiler.rb | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/ruby_vm/mjit/compiler.rb b/lib/ruby_vm/mjit/compiler.rb index 79a5da44a2..30f2557f5b 100644 --- a/lib/ruby_vm/mjit/compiler.rb +++ b/lib/ruby_vm/mjit/compiler.rb @@ -133,6 +133,12 @@ module RubyVM::MJIT list_blocks(iseq, pc).each do |block| invalidate_block(iseq, block) end + + # If they were the ISEQ's first blocks, re-compile MJIT entry as well + if iseq.body.iseq_encoded.to_i == pc + iseq.body.jit_func = 0 + iseq.body.total_calls = 0 + end end private @@ -255,7 +261,6 @@ module RubyVM::MJIT @cb.write(branch_asm) end end - # TODO: Reset jit_func and total_calls if it's the first block after prelude end def list_blocks(iseq, pc)