fix unconditional jump
and affected tests
This commit is contained in:
@ -8,7 +8,7 @@ module Risc
|
||||
super
|
||||
@input = "if(@a) ; arg = 5 ; else; arg = 6; end"
|
||||
@expect = [SlotToReg, SlotToReg, LoadConstant, IsSame, LoadConstant, IsSame ,
|
||||
Label, LoadConstant, SlotToReg, RegToSlot, Label, Label ,
|
||||
Label, LoadConstant, SlotToReg, RegToSlot, Unconditional, Label ,
|
||||
LoadConstant, SlotToReg, RegToSlot, Label]
|
||||
end
|
||||
|
||||
@ -45,7 +45,7 @@ module Risc
|
||||
|
||||
def test_true_jump # should jumpp to merge label
|
||||
produced = produce_body
|
||||
assert_equal "Jump" , produced.next(10).name
|
||||
assert produced.next(10).label.name.start_with?("merge_label")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -8,7 +8,7 @@ module Risc
|
||||
super
|
||||
@input = "while(@a) ; arg = 5 end"
|
||||
@expect = [Label, SlotToReg, SlotToReg, LoadConstant, IsSame, LoadConstant ,
|
||||
IsSame, LoadConstant, SlotToReg, RegToSlot, Label, Label]
|
||||
IsSame, LoadConstant, SlotToReg, RegToSlot, Unconditional, Label]
|
||||
end
|
||||
|
||||
def test_while_instructions
|
||||
@ -37,9 +37,9 @@ module Risc
|
||||
assert produced.next(11).name.start_with?("merge_label")
|
||||
end
|
||||
|
||||
def test_true_jump # should jumpp to merge label
|
||||
def test_back_jump # should jump back to condition label
|
||||
produced = produce_body
|
||||
assert_equal "Jump" , produced.next(10).name
|
||||
assert_equal produced , produced.next(10).label
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user