shaves an instruction off resolve_method
by loading nil directly, not space first
This commit is contained in:
@ -10,16 +10,15 @@ module Risc
|
||||
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
|
||||
OperatorInstruction, IsZero, SlotToReg, SlotToReg, SlotToReg,
|
||||
LoadConstant, RegToSlot, LoadConstant, LoadConstant, SlotToReg,
|
||||
SlotToReg, Label, LoadConstant, SlotToReg, OperatorInstruction,
|
||||
IsZero, SlotToReg, OperatorInstruction, IsZero, SlotToReg,
|
||||
Branch, Label, Transfer, Syscall, Transfer,
|
||||
Transfer, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, Label, RegToSlot, Label,
|
||||
LoadConstant, SlotToReg, LoadConstant, SlotToReg, SlotToReg,
|
||||
RegToSlot, RegToSlot, RegToSlot, RegToSlot, SlotToReg,
|
||||
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
|
||||
RegToSlot, SlotToReg, LoadConstant, SlotToReg, DynamicJump,
|
||||
Label]
|
||||
SlotToReg, Label, LoadConstant, OperatorInstruction, IsZero,
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch,
|
||||
Label, Transfer, Syscall, Transfer, Transfer,
|
||||
LoadConstant, SlotToReg, SlotToReg, RegToSlot, RegToSlot,
|
||||
RegToSlot, Label, RegToSlot, Label, LoadConstant,
|
||||
SlotToReg, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, RegToSlot, SlotToReg, SlotToReg,
|
||||
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
|
||||
SlotToReg, LoadConstant, SlotToReg, DynamicJump, Label]
|
||||
end
|
||||
|
||||
def test_send_instructions
|
||||
@ -27,23 +26,23 @@ module Risc
|
||||
end
|
||||
def test_sys
|
||||
produced = produce_body
|
||||
assert_equal Syscall , produced.next(28).class
|
||||
assert_equal :exit , produced.next(28).name
|
||||
assert_equal Syscall , produced.next(27).class
|
||||
assert_equal :exit , produced.next(27).name
|
||||
end
|
||||
def test_load_address
|
||||
produced = produce_body
|
||||
assert_equal LoadConstant , produced.next(40).class
|
||||
assert_equal Parfait::CacheEntry , produced.next(40).constant.class
|
||||
assert_equal LoadConstant , produced.next(41).class
|
||||
assert_equal Parfait::Factory , produced.next(41).constant.class
|
||||
end
|
||||
def test_function_call
|
||||
produced = produce_body
|
||||
assert_equal DynamicJump , produced.next(59).class
|
||||
assert_equal DynamicJump , produced.next(58).class
|
||||
end
|
||||
def test_cache_check
|
||||
produced = produce_body
|
||||
assert_equal IsZero , produced.next(6).class
|
||||
assert_equal Label , produced.next(39).class
|
||||
assert_equal produced.next(39) , produced.next(6).label
|
||||
assert_equal Label , produced.next(38).class
|
||||
assert_equal produced.next(38) , produced.next(6).label
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -10,17 +10,17 @@ module Risc
|
||||
@expect = [LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
|
||||
OperatorInstruction, IsZero, SlotToReg, SlotToReg, SlotToReg,
|
||||
LoadConstant, RegToSlot, LoadConstant, LoadConstant, SlotToReg,
|
||||
SlotToReg, Label, LoadConstant, SlotToReg, OperatorInstruction,
|
||||
IsZero, SlotToReg, OperatorInstruction, IsZero, SlotToReg,
|
||||
Branch, Label, Transfer, Syscall, Transfer,
|
||||
Transfer, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, Label, RegToSlot, Label,
|
||||
LoadConstant, SlotToReg, LoadConstant, SlotToReg, SlotToReg,
|
||||
RegToSlot, RegToSlot, RegToSlot, RegToSlot, SlotToReg,
|
||||
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
|
||||
RegToSlot, SlotToReg, LoadConstant, SlotToReg, DynamicJump,
|
||||
Label, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, RegToSlot, Branch]
|
||||
SlotToReg, Label, LoadConstant, OperatorInstruction, IsZero,
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, Branch,
|
||||
Label, Transfer, Syscall, Transfer, Transfer,
|
||||
LoadConstant, SlotToReg, SlotToReg, RegToSlot, RegToSlot,
|
||||
RegToSlot, Label, RegToSlot, Label, LoadConstant,
|
||||
SlotToReg, LoadConstant, SlotToReg, SlotToReg, RegToSlot,
|
||||
RegToSlot, RegToSlot, RegToSlot, SlotToReg, SlotToReg,
|
||||
SlotToReg, RegToSlot, LoadConstant, SlotToReg, RegToSlot,
|
||||
SlotToReg, LoadConstant, SlotToReg, DynamicJump, Label,
|
||||
SlotToReg, SlotToReg, RegToSlot, SlotToReg, SlotToReg,
|
||||
RegToSlot, Branch]
|
||||
end
|
||||
|
||||
def test_return_instructions
|
||||
@ -28,7 +28,7 @@ module Risc
|
||||
end
|
||||
def test_function_return
|
||||
produced = produce_body
|
||||
assert_equal Branch , produced.next(67).class
|
||||
assert_equal Branch , produced.next(66).class
|
||||
end
|
||||
def test_cache_check
|
||||
produced = produce_body
|
||||
|
Reference in New Issue
Block a user