Rewrite the stub if it's the last code

This commit is contained in:
Takashi Kokubun 2023-01-01 23:13:43 -08:00
parent c3d99d0f12
commit 4b6c738180
5 changed files with 45 additions and 26 deletions

View file

@ -37,21 +37,25 @@ module RubyVM::MJIT
start_addr
end
def with_addr(addr)
old_write_pos = @write_pos
def set_write_addr(addr)
@write_pos = addr - @mem_block
@comments.delete(addr) # TODO: clean up old comments for all overwritten insns?
@comments.delete(addr) # TODO: clean up old comments for all the overwritten range?
end
def with_write_addr(addr)
old_write_pos = @write_pos
set_addr(addr)
yield
ensure
@write_pos = old_write_pos
end
private
def write_addr
@mem_block + @write_pos
end
private
def dump_disasm(from, to)
C.dump_disasm(from, to).each do |address, mnemonic, op_str|
@comments.fetch(address, []).each do |comment|