move resolve_method code from word to mom
rather make resolve an instruction. Since it was coded in risc anyway, we not only save the setup and call But also makes the mom instruction flow clearer The method really came from not wanting to code it in risc, but with the Builder, that is now surprisingly painless
This commit is contained in:
@ -24,7 +24,7 @@ class TestSpace < MiniTest::Test
|
||||
end
|
||||
def test_methods_booted
|
||||
word = @space.get_class_by_name(:Word).instance_type
|
||||
assert_equal 4 , word.method_names.get_length
|
||||
assert_equal 3 , word.method_names.get_length
|
||||
assert word.get_method(:putstring) , "no putstring"
|
||||
end
|
||||
|
||||
|
@ -29,13 +29,10 @@ module Risc
|
||||
IsZero, SlotToReg, OperatorInstruction, IsNotZero, Label,
|
||||
SlotToReg, Branch, Label, LoadConstant, SlotToReg,
|
||||
OperatorInstruction, IsZero, SlotToReg, OperatorInstruction, IsNotZero,
|
||||
Label, SlotToReg, Branch, Label, LoadConstant,
|
||||
SlotToReg, OperatorInstruction, IsZero, SlotToReg, OperatorInstruction,
|
||||
IsNotZero, Label, SlotToReg, Branch, Label,
|
||||
LoadConstant, SlotToReg, OperatorInstruction, IsZero, SlotToReg,
|
||||
OperatorInstruction, IsNotZero, Label, SlotToReg, Branch,
|
||||
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
|
||||
Label, Transfer, Syscall, NilClass]
|
||||
RegToSlot, SlotToReg, SlotToReg, RegToSlot, SlotToReg,
|
||||
SlotToReg, FunctionReturn, SlotToReg, LoadConstant, RegToSlot,
|
||||
Label, LoadConstant, LoadConstant, SlotToReg, RegToSlot,
|
||||
RegToSlot, SlotToReg, SlotToReg]
|
||||
#assert_equal 1 , get_return
|
||||
end
|
||||
|
||||
|
@ -19,15 +19,15 @@ module Vool
|
||||
assert_equal :type , load.right.slots[1] , load
|
||||
end
|
||||
def test_check_resolve_call
|
||||
assert_equal SimpleCall , @ins.next(5).class , @ins
|
||||
assert_equal ResolveMethod , @ins.next(3).class , @ins
|
||||
end
|
||||
def test_dynamic_call_last
|
||||
assert_equal DynamicCall , @ins.last.class , @ins
|
||||
end
|
||||
|
||||
def test_array
|
||||
check_array [SlotLoad, NotSameCheck, SlotLoad, MessageSetup, ArgumentTransfer, SimpleCall ,
|
||||
SlotLoad, Label, MessageSetup, ArgumentTransfer, DynamicCall] , @ins
|
||||
check_array [SlotLoad, NotSameCheck, SlotLoad, ResolveMethod, Label, MessageSetup ,
|
||||
ArgumentTransfer, DynamicCall] , @ins
|
||||
end
|
||||
|
||||
end
|
||||
|
Reference in New Issue
Block a user