From 0ed5e747487ef47acc28e16083f16e6796bea9b5 Mon Sep 17 00:00:00 2001 From: Torsten Date: Mon, 16 Mar 2020 17:51:21 +0200 Subject: [PATCH] Fixing ripples from previous --- lib/slot_machine/macro/macro.rb | 2 +- test/risc/instructions/test_operator_instruction.rb | 2 +- test/risc/interpreter/calling/test_puts.rb | 4 ++-- test/slot_machine/macro/test_exit.rb | 6 +++--- test/slot_machine/macro/test_init.rb | 6 +++--- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/lib/slot_machine/macro/macro.rb b/lib/slot_machine/macro/macro.rb index e2699015..31fa825b 100644 --- a/lib/slot_machine/macro/macro.rb +++ b/lib/slot_machine/macro/macro.rb @@ -20,7 +20,7 @@ module SlotMachine # Assumes int return value and extracts the fixnum for process exit code def self.exit_sequence(builder) save_message( builder ) - unix_return = Risc.syscall_reg(1) + unix_return = Risc.syscall_reg(1).set_compiler(builder.compiler) builder.build do unix_return << message[:return_value].reduce_int(false) #hack, noo type check add_code Risc::Syscall.new("emit_syscall(exit)", :exit ) diff --git a/test/risc/instructions/test_operator_instruction.rb b/test/risc/instructions/test_operator_instruction.rb index d9b26453..327cdfdb 100644 --- a/test/risc/instructions/test_operator_instruction.rb +++ b/test/risc/instructions/test_operator_instruction.rb @@ -8,7 +8,7 @@ module Risc @right = RegisterValue.new(:right , :Integer) end def risc(i) - @left.op :- , @right + OperatorInstruction.new( "source" , :- , @left , @right ) end def test_min assert_operator 1 , :- , :left , :right , "op_-_" diff --git a/test/risc/interpreter/calling/test_puts.rb b/test/risc/interpreter/calling/test_puts.rb index 3976d967..3451d9f5 100644 --- a/test/risc/interpreter/calling/test_puts.rb +++ b/test/risc/interpreter/calling/test_puts.rb @@ -12,7 +12,7 @@ module Risc def test_chain #show_main_ticks # get output of what is - check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5 + check_main_chain [LoadConstant, SlotToReg, RegToSlot, LoadConstant, SlotToReg, #5 RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg, #10 FunctionCall, LoadConstant, LoadConstant, SlotToReg, OperatorInstruction, #15 IsNotZero, SlotToReg, RegToSlot, RegToSlot, SlotToReg, #20 @@ -22,7 +22,7 @@ module Risc RegToSlot, SlotToReg, SlotToReg, FunctionReturn, SlotToReg, #40 RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, #45 SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, #50 - SlotToReg, Syscall, NilClass,] #55 + SlotToReg, Transfer, Syscall, NilClass,] #55 assert_equal "Hello again" , @interpreter.stdout assert_equal Integer , get_return.class assert_equal 11 , get_return #bytes written diff --git a/test/slot_machine/macro/test_exit.rb b/test/slot_machine/macro/test_exit.rb index 5349bc05..37c4130a 100644 --- a/test/slot_machine/macro/test_exit.rb +++ b/test/slot_machine/macro/test_exit.rb @@ -24,9 +24,9 @@ module SlotMachine a = Risc.allocate_length assert_reg_to_slot a + 1 , "id_factory_.next_object" , :message , 5 assert_transfer a + 2 , :message , :saved_message - assert_slot_to_reg a + 3 ,:message , 5 , :message - assert_slot_to_reg a + 4 ,:message , 2 , "message.data_1" - assert_transfer a + 5 , :"message.data_1" , :message + assert_slot_to_reg a + 3 ,:message , 5 , :"message.return_value" + assert_slot_to_reg a + 4 ,:"message.return_value" , 2 , "message.return_value.data_1" + assert_transfer a + 5 , :"message.return_value.data_1" , :syscall_1 assert_syscall a + 6 , :exit assert_slot_to_reg a + 7 ,:message , 5 , "message.return_value" assert_reg_to_slot a + 8 , "message.return_value" , :message , 5 diff --git a/test/slot_machine/macro/test_init.rb b/test/slot_machine/macro/test_init.rb index 5a604d39..d0792fd4 100644 --- a/test/slot_machine/macro/test_init.rb +++ b/test/slot_machine/macro/test_init.rb @@ -34,9 +34,9 @@ module SlotMachine assert_function_call 13 , :main assert_label 14 , "Object.__init__" assert_transfer 15 , :message , :saved_message - assert_slot_to_reg 16 ,:message , 5 , :message - assert_slot_to_reg 17 ,:message , 2 , "message.data_1" - assert_transfer 18 , "message.data_1" , :message + assert_slot_to_reg 16 ,:message , 5 , :"message.return_value" + assert_slot_to_reg 17 ,:"message.return_value" , 2 , "message.return_value.data_1" + assert_transfer 18 , "message.return_value.data_1" , :syscall_1 assert_syscall 19, :exit end end