filing at dependencies

This commit is contained in:
Torsten Ruger 2018-03-18 22:36:36 +05:30
parent af94d40cab
commit 46ed4285a2

View File

@ -15,7 +15,6 @@ module Vool
def initialize(name , receiver , arguments )
@name , @receiver , @arguments = name , receiver , arguments
@arguments ||= []
@dynamic = Mom::DynamicCall.new()
end
def normalize
@ -30,6 +29,11 @@ module Vool
end
end
# lazy init this, to keep the dependency (which goes to parfait and booting) at bay
def dynamic_call
@dynamic ||= Mom::DynamicCall.new()
end
# A Send breaks down to 2 steps:
# - Setting up the next message, with receiver, arguments, and (importantly) return address
# - a CachedCall , or a SimpleCall, depending on wether the receiver type can be determined
@ -92,22 +96,22 @@ module Vool
# this may look like a simple_call, but the difference is that we don't know
# the method until run-time. Alas the setup is the same
def call_cached_method(in_method)
message_setup(in_method) << @dynamic
message_setup(in_method) << dynamic_call
end
private
def build_condition
cached_type = Mom::SlotDefinition.new(@dynamic.cache_entry , [:cached_type])
cached_type = Mom::SlotDefinition.new(dynamic_call.cache_entry , [:cached_type])
current_type = Mom::SlotDefinition.new(:message , [:receiver , :type])
Mom::NotSameCheck.new(cached_type , current_type)
end
def build_type_cache_update
Mom::SlotLoad.new([@dynamic.cache_entry, :cached_type] , [:message , :receiver , :type])
Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , [:message , :receiver , :type])
end
def build_method_cache_update(in_method)
receiver = StringConstant.new(@name)
resolve = SendStatement.new(:resolve_method , receiver , [SelfExpression.new])
move_method = Mom::SlotLoad.new([@dynamic.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
end
end