Implement jump

This commit is contained in:
Takashi Kokubun 2023-02-08 17:42:16 -08:00
parent 557bd86402
commit 091c2ee1ac

View file

@ -18,7 +18,7 @@ module RubyVM::MJIT
asm.incr_counter(:mjit_insns_count) asm.incr_counter(:mjit_insns_count)
asm.comment("Insn: #{insn.name}") asm.comment("Insn: #{insn.name}")
# 29/101 # 30/101
case insn.name case insn.name
when :nop then nop(jit, ctx, asm) when :nop then nop(jit, ctx, asm)
# getlocal # getlocal
@ -82,7 +82,7 @@ module RubyVM::MJIT
# invokeblock # invokeblock
when :leave then leave(jit, ctx, asm) when :leave then leave(jit, ctx, asm)
# throw # throw
# jump when :jump then jump(jit, ctx, asm)
# branchif # branchif
when :branchunless then branchunless(jit, ctx, asm) when :branchunless then branchunless(jit, ctx, asm)
# branchnil # branchnil
@ -331,7 +331,18 @@ module RubyVM::MJIT
end end
# throw # throw
# jump
# @param jit [RubyVM::MJIT::JITState]
# @param ctx [RubyVM::MJIT::Context]
# @param asm [RubyVM::MJIT::Assembler]
def jump(jit, ctx, asm)
# TODO: check ints for backward branches
pc = jit.pc + C.VALUE.size * (jit.insn.len + jit.operand(0))
stub_next_block(jit.iseq, pc, ctx, asm)
EndBlock
end
# branchif # branchif
# @param jit [RubyVM::MJIT::JITState] # @param jit [RubyVM::MJIT::JITState]