fix dynamic resolution
was loading self, when it needs to load receiver some more test (up to the resolve) start working
This commit is contained in:
parent
c304ad67c6
commit
17b52d4e80
@ -149,7 +149,6 @@ module Risc
|
|||||||
else
|
else
|
||||||
value = object.get_internal_word( index )
|
value = object.get_internal_word( index )
|
||||||
end
|
end
|
||||||
#value = value.object_id unless value.is_a? Fixnum
|
|
||||||
set_register( @instruction.register , value )
|
set_register( @instruction.register , value )
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
@ -119,7 +119,7 @@ module Vool
|
|||||||
end
|
end
|
||||||
def build_method_cache_update(in_method)
|
def build_method_cache_update(in_method)
|
||||||
receiver = SymbolConstant.new(@name)
|
receiver = SymbolConstant.new(@name)
|
||||||
resolve = SendStatement.new(:resolve_method , receiver , [SelfExpression.new])
|
resolve = SendStatement.new(:resolve_method , receiver , [@receiver])
|
||||||
move_method = Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_method] , [:message , :return_value])
|
move_method = Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_method] , [:message , :return_value])
|
||||||
resolve.to_mom(in_method) << move_method
|
resolve.to_mom(in_method) << move_method
|
||||||
end
|
end
|
||||||
|
@ -23,31 +23,39 @@ module Risc
|
|||||||
SlotToReg, SlotToReg, SlotToReg, SlotToReg, RegToSlot,
|
SlotToReg, SlotToReg, SlotToReg, SlotToReg, RegToSlot,
|
||||||
LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
|
LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
|
||||||
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg,
|
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg,
|
||||||
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
|
SlotToReg, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
|
||||||
RegToSlot, SlotToReg, LoadConstant, FunctionCall, Label,
|
SlotToReg, RegToSlot, SlotToReg, LoadConstant, FunctionCall,
|
||||||
SlotToReg, SlotToReg, SlotToReg, SlotToReg, Label,
|
Label, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
|
||||||
LoadConstant, SlotToReg, OperatorInstruction, IsZero, SlotToReg,
|
|
||||||
OperatorInstruction, IsNotZero, Label, SlotToReg, Branch,
|
|
||||||
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
|
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
|
||||||
Label, Transfer, Syscall, NilClass]
|
Label, Transfer, Syscall, NilClass]
|
||||||
#assert_equal 1 , get_return
|
#assert_equal 1 , get_return
|
||||||
end
|
end
|
||||||
|
|
||||||
def est_call_main
|
def test_call_main
|
||||||
call_ins = ticks(25)
|
call_ins = ticks(26)
|
||||||
assert_equal FunctionCall , call_ins.class
|
assert_equal FunctionCall , call_ins.class
|
||||||
assert_equal :main , call_ins.method.name
|
assert_equal :main , call_ins.method.name
|
||||||
end
|
end
|
||||||
def est_call_resolve
|
def test_call_resolve
|
||||||
call_ins = ticks(68)
|
call_ins = ticks(70)
|
||||||
assert_equal FunctionCall , call_ins.class
|
assert_equal FunctionCall , call_ins.class
|
||||||
assert_equal :resolve_method , call_ins.method.name
|
assert_equal :resolve_method , call_ins.method.name
|
||||||
end
|
end
|
||||||
def est_label
|
def test_label
|
||||||
call_ins = ticks(69)
|
call_ins = ticks(71)
|
||||||
assert_equal Label , call_ins.class
|
assert_equal Label , call_ins.class
|
||||||
assert_equal "Word_Type.resolve_method" , call_ins.name
|
assert_equal "Word_Type.resolve_method" , call_ins.name
|
||||||
end
|
end
|
||||||
|
def test_arg_15_to_resolve
|
||||||
|
sl = ticks( 74 )
|
||||||
|
assert_equal SlotToReg , sl.class
|
||||||
|
assert_equal :r2 , sl.array.symbol #load from message
|
||||||
|
assert_equal 2 , sl.index
|
||||||
|
assert_equal :r2 , sl.register.symbol
|
||||||
|
assert_equal Parfait::Integer, @interpreter.get_register( :r2 ).class
|
||||||
|
assert_equal 15, @interpreter.get_register( :r2 ).value
|
||||||
|
end
|
||||||
|
|
||||||
def est_dyn
|
def est_dyn
|
||||||
cal = ticks(102)
|
cal = ticks(102)
|
||||||
assert_equal DynamicJump , cal.class
|
assert_equal DynamicJump , cal.class
|
||||||
|
Loading…
x
Reference in New Issue
Block a user