implement DynamicJump for Arm

which is in fact the same as return (moving address into pc)
This commit is contained in:
Torsten Ruger 2018-06-24 19:13:55 +03:00
parent f83f52faa0
commit 068bda492c
2 changed files with 19 additions and 1 deletions

View File

@ -65,9 +65,10 @@ module Arm
ArmMachine.b( code.method.binary )
end
def translate_FunctionReturn code
def translate_FunctionReturn( code )
ArmMachine.mov( :pc , code.register)
end
alias :translate_DynamicJump :translate_FunctionReturn
def translate_LoadConstant( code )
constant = code.constant

View File

@ -0,0 +1,17 @@
require_relative 'helper'
module Arm
class TestStack < MiniTest::Test
def test_init
assert Translator.new
end
def test_dynamic
trans = Translator.new
jump = Risc::DynamicJump.new("" , :r1)
res = trans.translate jump
assert :r1 , res.from
end
end
end