fix logic error in vool dynamic send

using receiver of current method
instead of receiver of next message
This commit is contained in:
Torsten Ruger
2018-04-08 22:59:42 +03:00
parent 580c53cdae
commit fabe4db4f6
4 changed files with 37 additions and 27 deletions

View File

@ -7,18 +7,19 @@ module Risc
def setup
super
@input = "@a.mod4"
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, OperatorInstruction,
IsZero, SlotToReg, SlotToReg, LoadConstant, RegToSlot,
LoadConstant, LoadConstant, SlotToReg, SlotToReg, Label,
LoadConstant, SlotToReg, OperatorInstruction, IsZero, SlotToReg,
OperatorInstruction, IsZero, SlotToReg, Branch, Label,
Transfer, Syscall, Transfer, Transfer, LoadConstant,
SlotToReg, SlotToReg, RegToSlot, RegToSlot, RegToSlot,
Label, RegToSlot, Label, LoadConstant, LoadConstant,
SlotToReg, RegToSlot, RegToSlot, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
RegToSlot, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
SlotToReg, RegToSlot, LoadConstant, SlotToReg, DynamicJump]
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
OperatorInstruction, IsZero, SlotToReg, SlotToReg, SlotToReg,
LoadConstant, RegToSlot, LoadConstant, LoadConstant, SlotToReg,
SlotToReg, Label, LoadConstant, SlotToReg, OperatorInstruction,
IsZero, SlotToReg, OperatorInstruction, IsZero, SlotToReg,
Branch, Label, Transfer, Syscall, Transfer,
Transfer, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
RegToSlot, RegToSlot, Label, RegToSlot, Label,
LoadConstant, LoadConstant, SlotToReg, RegToSlot, RegToSlot,
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
RegToSlot, SlotToReg, RegToSlot, SlotToReg, RegToSlot,
SlotToReg, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, DynamicJump]
end
def test_send_instructions
@ -26,23 +27,23 @@ module Risc
end
def test_sys
produced = produce_body
assert_equal Syscall , produced.next(26).class
assert_equal :exit , produced.next(26).name
assert_equal Syscall , produced.next(28).class
assert_equal :exit , produced.next(28).name
end
def test_load_address
produced = produce_body
assert_equal LoadConstant , produced.next(38).class
assert_equal Parfait::CacheEntry , produced.next(38).constant.class
assert_equal LoadConstant , produced.next(40).class
assert_equal Parfait::CacheEntry , produced.next(40).constant.class
end
def test_function_call
produced = produce_body
assert_equal DynamicJump , produced.next(59).class
assert_equal DynamicJump , produced.next(61).class
end
def test_cache_check
produced = produce_body
assert_equal IsZero , produced.next(5).class
assert_equal Label , produced.next(37).class
assert_equal produced.next(37) , produced.next(5).label
assert_equal IsZero , produced.next(6).class
assert_equal Label , produced.next(39).class
assert_equal produced.next(39) , produced.next(6).label
end
end
end