diff options
author | Takashi Kokubun <[email protected]> | 2023-02-18 14:45:17 -0800 |
---|---|---|
committer | Takashi Kokubun <[email protected]> | 2023-03-05 23:28:59 -0800 |
commit | feb60f6f5107561f2e83e3f53b1db52d2b201708 (patch) | |
tree | 1516b160b90070bed0c8a53248439690d688684e /lib/ruby_vm/mjit/insn_compiler.rb | |
parent | 2cc4f506bac0748277b41a4a5eb6f0ec41dd7344 (diff) |
Invalidate blocks on constant IC updates
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7448
Diffstat (limited to 'lib/ruby_vm/mjit/insn_compiler.rb')
-rw-r--r-- | lib/ruby_vm/mjit/insn_compiler.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/lib/ruby_vm/mjit/insn_compiler.rb b/lib/ruby_vm/mjit/insn_compiler.rb index a06030fd6f..d52c5816b1 100644 --- a/lib/ruby_vm/mjit/insn_compiler.rb +++ b/lib/ruby_vm/mjit/insn_compiler.rb @@ -214,9 +214,20 @@ module RubyVM::MJIT # @param ctx [RubyVM::MJIT::Context] # @param asm [RubyVM::MJIT::Assembler] def opt_getconstant_path(jit, ctx, asm) + # Cut the block for invalidation + unless jit.at_current_insn? + defer_compilation(jit, ctx, asm) + return EndBlock + end + ic = C.iseq_inline_constant_cache.new(jit.operand(0)) idlist = ic.segments + # Make sure there is an exit for this block as the interpreter might want + # to invalidate this block from rb_mjit_constant_ic_update(). + # For now, we always take an entry exit even if it was a side exit. + Invariants.ensure_block_entry_exit(jit, cause: 'opt_getconstant_path') + # See vm_ic_hit_p(). The same conditions are checked in yjit_constant_ic_update(). ice = ic.entry if ice.nil? @@ -226,10 +237,6 @@ module RubyVM::MJIT return CantCompile end - # Make sure there is an exit for this block as the interpreter might want - # to invalidate this block from yjit_constant_ic_update(). - Invariants.ensure_block_entry_exit(jit, cause: 'opt_getconstant_path') - if ice.ic_cref # with cref # Not supported yet asm.incr_counter(:optgetconst_cref) |