shaves an instruction off resolve_method

by loading nil directly,  not space first
This commit is contained in:
Torsten Ruger
2018-09-01 11:20:59 +03:00
parent c3b026a180
commit 0a390cc5a9
7 changed files with 61 additions and 66 deletions

View File

@ -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