fix return sequence

broken due to logic error in register_slot << (which was reducing the wrong register, self, not the arg)

Still the sequence is in 2 places, one too many ?
This commit is contained in:
Torsten 2020-03-09 14:00:46 +02:00
parent 05ddc70fd6
commit 8119030ed2
2 changed files with 4 additions and 4 deletions

View File

@ -12,10 +12,10 @@ module SlotMachine
assert_slot_to_reg 1,:message , 6 , "message.caller"
end
def test_2_load_caller
assert_slot_to_reg 2,"message.caller" , 5 , "message.caller.return_value"
assert_slot_to_reg 2, "message" , 5 , "message.return_value"
end
def test_3_store_return_in_caller
assert_reg_to_slot 3, "message.caller.return_value" , "message.caller" , 5
assert_reg_to_slot 3, "message.return_value" , "message.caller" , 5
end
def test_4_load_return_address
assert_slot_to_reg 4,:message , 4 , "message.return_address"

View File

@ -21,8 +21,8 @@ module SlotMachine
def assert_return(at)
assert_label at , "return_label"
assert_slot_to_reg at + 1 , :message , 6 , "message.caller"
assert_slot_to_reg at + 2 , "message.caller" , 5 , "message.caller.return_value"
assert_reg_to_slot at + 3 ,"message.caller.return_value" , "message.caller" , 5
assert_slot_to_reg at + 2 , "message" , 5 , "message.return_value"
assert_reg_to_slot at + 3 ,"message.return_value" , "message.caller" , 5
assert_slot_to_reg at + 4 , :message , 4 , "message.return_address"
assert_slot_to_reg at + 5 , :message , 6 , :message
assert_equal Risc::FunctionReturn , risc(at + 6).class