implement DynamicJump for Arm
which is in fact the same as return (moving address into pc)
This commit is contained in:
parent
f83f52faa0
commit
068bda492c
@ -65,9 +65,10 @@ module Arm
|
|||||||
ArmMachine.b( code.method.binary )
|
ArmMachine.b( code.method.binary )
|
||||||
end
|
end
|
||||||
|
|
||||||
def translate_FunctionReturn code
|
def translate_FunctionReturn( code )
|
||||||
ArmMachine.mov( :pc , code.register)
|
ArmMachine.mov( :pc , code.register)
|
||||||
end
|
end
|
||||||
|
alias :translate_DynamicJump :translate_FunctionReturn
|
||||||
|
|
||||||
def translate_LoadConstant( code )
|
def translate_LoadConstant( code )
|
||||||
constant = code.constant
|
constant = code.constant
|
||||||
|
17
test/arm/test_translator.rb
Normal file
17
test/arm/test_translator.rb
Normal 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
|
Loading…
Reference in New Issue
Block a user