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:
Torsten Ruger 2018-04-03 12:55:28 +03:00
parent c304ad67c6
commit 17b52d4e80
3 changed files with 20 additions and 13 deletions

View File

@ -149,7 +149,6 @@ module Risc
else
value = object.get_internal_word( index )
end
#value = value.object_id unless value.is_a? Fixnum
set_register( @instruction.register , value )
true
end

View File

@ -119,7 +119,7 @@ module Vool
end
def build_method_cache_update(in_method)
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])
resolve.to_mom(in_method) << move_method
end

View File

@ -23,31 +23,39 @@ module Risc
SlotToReg, SlotToReg, SlotToReg, SlotToReg, RegToSlot,
LoadConstant, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
RegToSlot, LoadConstant, SlotToReg, RegToSlot, SlotToReg,
SlotToReg, SlotToReg, RegToSlot, LoadConstant, SlotToReg,
RegToSlot, SlotToReg, LoadConstant, FunctionCall, Label,
SlotToReg, SlotToReg, SlotToReg, SlotToReg, Label,
LoadConstant, SlotToReg, OperatorInstruction, IsZero, SlotToReg,
OperatorInstruction, IsNotZero, Label, SlotToReg, Branch,
SlotToReg, SlotToReg, SlotToReg, RegToSlot, LoadConstant,
SlotToReg, RegToSlot, SlotToReg, LoadConstant, FunctionCall,
Label, SlotToReg, SlotToReg, SlotToReg, SlotToReg,
Label, LoadConstant, SlotToReg, OperatorInstruction, IsZero,
Label, Transfer, Syscall, NilClass]
#assert_equal 1 , get_return
end
def est_call_main
call_ins = ticks(25)
def test_call_main
call_ins = ticks(26)
assert_equal FunctionCall , call_ins.class
assert_equal :main , call_ins.method.name
end
def est_call_resolve
call_ins = ticks(68)
def test_call_resolve
call_ins = ticks(70)
assert_equal FunctionCall , call_ins.class
assert_equal :resolve_method , call_ins.method.name
end
def est_label
call_ins = ticks(69)
def test_label
call_ins = ticks(71)
assert_equal Label , call_ins.class
assert_equal "Word_Type.resolve_method" , call_ins.name
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
cal = ticks(102)
assert_equal DynamicJump , cal.class