fix integer plus
mostly forgot the return sequence
This commit is contained in:
parent
8acfda457f
commit
10fa61aa9f
@ -20,13 +20,13 @@ module Risc
|
||||
compiler = compiler_for(:Integer,:+ ,{other: :Integer})
|
||||
me , other = compiler.self_and_int_arg(source + "1")
|
||||
# reduce me and other to integers
|
||||
compiler.add_slot_to_reg( source + "2" , me , Parfait::Integer.integer_index , me)
|
||||
compiler.add_slot_to_reg( source + "3", other , Parfait::Integer.integer_index , other)
|
||||
compiler.reduce_int( source + "2", me )
|
||||
compiler.reduce_int( source + "3", other )
|
||||
compiler.add_code Risc.op( source + "4", :+ , me , other)
|
||||
compiler.add_new_int(me , other)
|
||||
compiler.add_reg_to_slot( source + "5" , other , :message , :return_value)
|
||||
compiler.add_mom( Mom::ReturnSequence.new)
|
||||
return compiler.method
|
||||
|
||||
end
|
||||
def div10( context )
|
||||
s = "div_10 "
|
||||
|
@ -24,7 +24,11 @@ module Risc
|
||||
SlotToReg, RegToSlot, SlotToReg, LoadConstant, FunctionCall,
|
||||
Label, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
|
||||
SlotToReg, OperatorInstruction, LoadConstant, SlotToReg, SlotToReg,
|
||||
RegToSlot, RegToSlot, RegToSlot, Label, NilClass]
|
||||
RegToSlot, RegToSlot, RegToSlot, SlotToReg, SlotToReg,
|
||||
RegToSlot, SlotToReg, SlotToReg, FunctionReturn, SlotToReg,
|
||||
SlotToReg, RegToSlot, SlotToReg, SlotToReg, RegToSlot,
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
||||
FunctionReturn, Transfer, Syscall, NilClass]
|
||||
assert_equal Parfait::Integer , get_return.class
|
||||
assert_equal 10 , get_return.value
|
||||
end
|
||||
@ -99,5 +103,10 @@ module Risc
|
||||
assert_equal 5 , sl.index
|
||||
assert_equal :r4 , sl.register.symbol
|
||||
end
|
||||
def test_sys
|
||||
sys = ticks(88)
|
||||
assert_equal Syscall , sys.class
|
||||
assert_equal :exit , sys.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
Loading…
x
Reference in New Issue
Block a user