start to move slot_load code to register_value
the iea is to iterate through register_values while reducing the slot_load to a number of Slot_to_regs wip
This commit is contained in:
@ -5,17 +5,17 @@ module Mom
|
||||
|
||||
def setup
|
||||
Parfait.boot!
|
||||
Risc.boot!
|
||||
@load = SlotLoad.new( [:message, :caller] , [:message, :caller , :type] )
|
||||
@load = SlotLoad.new( [:message, :caller, :type] , [:message, :caller , :type] )
|
||||
@compiler = CompilerMock.new
|
||||
@instruction = @load.to_risc(@compiler)
|
||||
end
|
||||
|
||||
def test_ins_next_class
|
||||
assert_equal Risc::SlotToReg , @instruction.next.class
|
||||
assert_equal Risc::SlotToReg , @instruction.next(1).class
|
||||
assert_equal Risc::SlotToReg , @instruction.next(2).class
|
||||
end
|
||||
def test_ins_next_next_class
|
||||
assert_equal Risc::RegToSlot , @instruction.next.next.class
|
||||
assert_equal Risc::RegToSlot , @instruction.next(3).class
|
||||
end
|
||||
|
||||
def test_ins_next_reg
|
||||
@ -28,14 +28,24 @@ module Mom
|
||||
assert_equal 0 , @instruction.next.index
|
||||
end
|
||||
|
||||
def test_ins_next_next_reg
|
||||
assert_equal :r1 , @instruction.next.next.register.symbol
|
||||
def test_ins_next_2_reg
|
||||
assert_equal :r1 , @instruction.next(2).register.symbol
|
||||
end
|
||||
def test_ins_next_next_arr
|
||||
assert_equal :r0 , @instruction.next.next.array.symbol
|
||||
def test_ins_next_2_arr
|
||||
assert_equal :r0 , @instruction.next(2).array.symbol
|
||||
end
|
||||
def test_ins_next_next_index
|
||||
assert_equal 6 , @instruction.next.next.index
|
||||
def test_ins_next_2_index
|
||||
assert_equal 6 , @instruction.next(2).index
|
||||
end
|
||||
|
||||
def test_ins_next_3_reg
|
||||
assert_equal :r1 , @instruction.next(3).register.symbol
|
||||
end
|
||||
def test_ins_next_3_arr
|
||||
assert_equal :r1 , @instruction.next(3).array.symbol
|
||||
end
|
||||
def test_ins_next_3_index
|
||||
assert_equal 0 , @instruction.next(3).index
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user