reducing the label's int for return

placing the raw address in the register to jump to
puts the extra instruction at the risc level (not arm), thus changing a
lot of (brittle?) tests
This commit is contained in:
Torsten Ruger
2018-05-30 12:54:40 +03:00
parent 01a2911483
commit 53107d3ef8
28 changed files with 202 additions and 176 deletions

View File

@ -14,7 +14,7 @@ module Risc
RegToSlot, SlotToReg, FunctionCall, Label, SlotToReg,
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
FunctionReturn]
SlotToReg, FunctionReturn]
end
def test_return_instructions
@ -22,7 +22,7 @@ module Risc
end
def test_function_return
produced = produce_body
assert_equal FunctionReturn , produced.next(35).class
assert_equal FunctionReturn , produced.next(36).class
end
def test_load_5
produced = produce_body

View File

@ -22,7 +22,8 @@ module Risc
LoadConstant, SlotToReg, RegToSlot, SlotToReg, LoadConstant,
SlotToReg, DynamicJump, Label, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
SlotToReg, RegToSlot, SlotToReg, SlotToReg, FunctionReturn]
SlotToReg, RegToSlot, SlotToReg, SlotToReg, SlotToReg,
FunctionReturn]
end
def test_return_instructions
@ -30,7 +31,7 @@ module Risc
end
def test_function_return
produced = produce_body
assert_equal FunctionReturn , produced.next(79).class
assert_equal FunctionReturn , produced.next(80).class
end
def test_cache_check
produced = produce_body

View File

@ -7,8 +7,8 @@ module Risc
def setup
super
@input = "return 5"
@expect = [LoadConstant, RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg ,
SlotToReg, FunctionReturn]
@expect = [LoadConstant, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
SlotToReg, SlotToReg, SlotToReg, FunctionReturn]
end
def test_return_instructions
@ -16,7 +16,7 @@ module Risc
end
def test_function_return
produced = produce_body
assert_equal FunctionReturn , produced.next(7).class
assert_equal FunctionReturn , produced.next(8).class
end
def test_load_5
produced = produce_body