mirror of
https://github.com/ruby/ruby.git
synced 2025-08-25 14:05:02 +02:00
Change a branch stub shape only when needed
This commit is contained in:
parent
bef63f445b
commit
993c43e429
Notes:
git
2023-03-06 07:29:56 +00:00
1 changed files with 6 additions and 1 deletions
|
@ -248,13 +248,18 @@ module RubyVM::MJIT
|
|||
next if target.nil?
|
||||
# TODO: Could target.address be a stub address? Is invalidation not needed in that case?
|
||||
|
||||
# If the target being re-generated is currently a fallthrough block,
|
||||
# the fallthrough code must be rewritten with a jump to the stub.
|
||||
if target.address == branch_stub.end_addr
|
||||
branch_stub.shape = Default
|
||||
end
|
||||
|
||||
target.address = Assembler.new.then do |ocb_asm|
|
||||
@exit_compiler.compile_branch_stub(block.ctx, ocb_asm, branch_stub, target == branch_stub.target0)
|
||||
@ocb.write(ocb_asm)
|
||||
end
|
||||
@cb.with_write_addr(branch_stub.start_addr) do
|
||||
branch_asm = Assembler.new
|
||||
branch_stub.shape = Default # cancel fallthrough. TODO: It seems fine for defer_compilation, but is this always safe?
|
||||
branch_stub.compile.call(branch_asm)
|
||||
@cb.write(branch_asm)
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue