init fell into the ssa tap, fixed

reducing and assuming the same register, buuh
adds a transfer instruction that can hopefully be removed by analysis
This commit is contained in:
Torsten 2020-03-15 10:39:09 +02:00
parent 5b0c1195e4
commit 3145547315
6 changed files with 20 additions and 17 deletions

View File

@ -22,7 +22,8 @@ module SlotMachine
save_message( builder )
builder.build do
message << message[:return_value]
message.reduce_int(false) #hack, noo type check
int = message.reduce_int(false) #hack, noo type check
message << int
add_code Risc::Syscall.new("emit_syscall(exit)", :exit )
end
end

View File

@ -13,10 +13,10 @@ module Risc
#show_main_ticks # get output of what is
check_main_chain [LoadConstant, RegToSlot, SlotToReg, RegToSlot, Branch, #5
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #10
FunctionReturn, Transfer, SlotToReg, SlotToReg, Syscall, #15
NilClass,] #20
assert_equal Parfait::Integer , get_return.class
assert_equal 15 , get_return.value
FunctionReturn, Transfer, SlotToReg, SlotToReg, Transfer,
Syscall, NilClass,] #20
assert_equal ::Integer , get_return.class
assert_equal 15 , get_return
end
def test_call_main
call_ins = ticks(main_at)
@ -40,7 +40,7 @@ module Risc
assert_transfer 12 , :message , :saved_message
end
def test_sys
assert_syscall 15 , :exit
assert_syscall 16 , :exit
end
end
end

View File

@ -26,9 +26,9 @@ module Risc
Branch, SlotToReg, RegToSlot, SlotToReg, SlotToReg, #60
FunctionReturn, SlotToReg, RegToSlot, Branch, SlotToReg, #65
SlotToReg, RegToSlot, SlotToReg, SlotToReg, FunctionReturn, #70
Transfer, SlotToReg, SlotToReg, Syscall, NilClass,] #75
assert_equal Parfait::Integer , get_return.class
assert_equal 1 , get_return.value
Transfer, SlotToReg, SlotToReg, Transfer ,Syscall, NilClass,] #75
assert_equal ::Integer , get_return.class
assert_equal 1 , get_return
end
def test_load_entry
call_ins = main_ticks(3)

View File

@ -19,7 +19,7 @@ module Risc
@instruction_events << was
end
def length
27
28
end
def test_state_change
@interpreter.register_event :state_changed , self
@ -44,9 +44,9 @@ module Risc
RegToSlot, LoadConstant, RegToSlot, FunctionCall, LoadConstant, #15
RegToSlot, Branch, SlotToReg, SlotToReg, RegToSlot, #20
SlotToReg, SlotToReg, FunctionReturn, Transfer, SlotToReg, #25
SlotToReg, Syscall, NilClass,] #30
assert_equal Parfait::Integer , get_return.class
assert_equal 5 , get_return.value
SlotToReg, Transfer, Syscall, NilClass,] #30
assert_equal ::Integer , get_return.class
assert_equal 5 , get_return
end
def test_length
run_all

View File

@ -13,13 +13,14 @@ module Risc
# show_main_ticks # get output of what is
check_main_chain [LoadConstant, RegToSlot, Branch, SlotToReg, SlotToReg, #5
RegToSlot, SlotToReg, SlotToReg, FunctionReturn, Transfer, #10
SlotToReg, SlotToReg, Syscall, NilClass,] #15
assert_equal 5 , get_return.value
SlotToReg, SlotToReg, Transfer, Syscall, NilClass,] #15
assert_equal 5 , get_return
end
def test_call_main
assert_function_call 0 , :main
end
def test_function_return
ret = main_ticks(9)
assert_equal FunctionReturn , ret.class

View File

@ -16,7 +16,7 @@ module SlotMachine
assert_equal Risc::MethodCompiler , @method.to_risc.class
end
def test_risc_length
assert_equal 19 , @method.to_risc.risc_instructions.length
assert_equal 20 , @method.to_risc.risc_instructions.length
end
def test_all
assert_load 1 , Parfait::Factory , "id_factory_"
@ -36,7 +36,8 @@ module SlotMachine
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_syscall 18, :exit
assert_transfer 18 , "message.data_1" , :message
assert_syscall 19, :exit
end
end
end