mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 22:14:37 +02:00
Skip invalidation for trace_ insns
This commit is contained in:
parent
feb60f6f51
commit
bef63f445b
Notes:
git
2023-03-06 07:29:56 +00:00
2 changed files with 21 additions and 11 deletions
|
@ -4,6 +4,7 @@ class RubyVM::MJIT::Block < Struct.new(
|
||||||
:start_addr, # @param [Integer] Starting address of this block's JIT code
|
:start_addr, # @param [Integer] Starting address of this block's JIT code
|
||||||
:entry_exit, # @param [Integer] Address of entry exit (optional)
|
:entry_exit, # @param [Integer] Address of entry exit (optional)
|
||||||
:incoming, # @param [Array<RubyVM::MJIT::BranchStub>] Incoming branches
|
:incoming, # @param [Array<RubyVM::MJIT::BranchStub>] Incoming branches
|
||||||
|
:invalidated, # @param [TrueClass,FalseClass] true if already invalidated
|
||||||
)
|
)
|
||||||
def initialize(incoming: [], **) = super
|
def initialize(incoming: [], invalidated: false, **) = super
|
||||||
end
|
end
|
||||||
|
|
|
@ -203,6 +203,12 @@ module RubyVM::MJIT
|
||||||
break
|
break
|
||||||
when CantCompile
|
when CantCompile
|
||||||
@exit_compiler.compile_side_exit(jit.pc, ctx, asm)
|
@exit_compiler.compile_side_exit(jit.pc, ctx, asm)
|
||||||
|
|
||||||
|
# If this is the first instruction, this block never needs to be invalidated.
|
||||||
|
if block.pc == iseq.body.iseq_encoded.to_i + index * C.VALUE.size
|
||||||
|
block.invalidated = true
|
||||||
|
end
|
||||||
|
|
||||||
break
|
break
|
||||||
else
|
else
|
||||||
raise "compiling #{insn.name} returned unexpected status: #{status.inspect}"
|
raise "compiling #{insn.name} returned unexpected status: #{status.inspect}"
|
||||||
|
@ -224,12 +230,15 @@ module RubyVM::MJIT
|
||||||
remove_block(iseq, block)
|
remove_block(iseq, block)
|
||||||
|
|
||||||
# Invalidate the block with entry exit
|
# Invalidate the block with entry exit
|
||||||
|
unless block.invalidated
|
||||||
@cb.with_write_addr(block.start_addr) do
|
@cb.with_write_addr(block.start_addr) do
|
||||||
asm = Assembler.new
|
asm = Assembler.new
|
||||||
asm.comment('invalidate_block')
|
asm.comment('invalidate_block')
|
||||||
asm.jmp(block.entry_exit)
|
asm.jmp(block.entry_exit)
|
||||||
@cb.write(asm)
|
@cb.write(asm)
|
||||||
end
|
end
|
||||||
|
block.invalidated = true
|
||||||
|
end
|
||||||
|
|
||||||
# Re-stub incoming branches
|
# Re-stub incoming branches
|
||||||
block.incoming.each do |branch_stub|
|
block.incoming.each do |branch_stub|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue