fix logic error in vool dynamic send
using receiver of current method instead of receiver of next message
This commit is contained in:
@ -108,7 +108,10 @@ module Mom
|
||||
# desctructively replace the existing value to be loaded if more slots
|
||||
index = Risc.resolve_to_index(slots[0] , slots[1] ,compiler)
|
||||
const << Risc::SlotToReg.new( instruction , right ,index, right)
|
||||
raise "more slots not implemented #{slots}" if slots.length > 2
|
||||
if slots.length > 2
|
||||
raise "3 slots only for type #{slots}" unless slots[2] == :type
|
||||
const << Risc::SlotToReg.new( instruction , right , 1, right)
|
||||
end
|
||||
end
|
||||
const
|
||||
end
|
||||
|
@ -93,8 +93,8 @@ module Vool
|
||||
# conceptually easy in ruby, but we have to compile that "easy" ruby
|
||||
def cache_check(in_method)
|
||||
ok = Mom::Label.new("cache_ok_#{self.object_id}")
|
||||
check = build_condition(ok) # if cached_type != current_type
|
||||
check << Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , [:message , :receiver , :type])
|
||||
check = build_condition(ok, in_method) # if cached_type != current_type
|
||||
check << Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , receiver_type_definition(in_method))
|
||||
check << Mom::ResolveMethod.new( @name , dynamic_call.cache_entry )
|
||||
check << ok
|
||||
end
|
||||
@ -106,9 +106,14 @@ module Vool
|
||||
end
|
||||
|
||||
private
|
||||
def build_condition(ok_label)
|
||||
def receiver_type_definition(in_method)
|
||||
defi = @receiver.slot_definition(in_method)
|
||||
defi.slots << :type
|
||||
defi
|
||||
end
|
||||
def build_condition(ok_label, in_method)
|
||||
cached_type = Mom::SlotDefinition.new(dynamic_call.cache_entry , [:cached_type])
|
||||
current_type = Mom::SlotDefinition.new(:message , [:receiver , :type])
|
||||
current_type = receiver_type_definition(in_method)
|
||||
Mom::NotSameCheck.new(cached_type , current_type, ok_label)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user