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:
Torsten Ruger
2018-04-08 18:55:17 +03:00
parent 8c322329fb
commit 33ffcf1d88
8 changed files with 84 additions and 28 deletions

View File

@ -94,8 +94,8 @@ module Vool
def cache_check(in_method)
ok = Mom::Label.new("cache_ok_#{self.object_id}")
check = build_condition(ok) # if cached_type != current_type
check << build_type_cache_update # cached_type = current_type
check << build_method_cache_update(in_method)# cached_method = current_type.resolve_method(method.name)
check << Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , [:message , :receiver , :type])
check << Mom::ResolveMethod.new( @name , dynamic_call.cache_entry )
check << ok
end
@ -111,14 +111,5 @@ module Vool
current_type = Mom::SlotDefinition.new(:message , [:receiver , :type])
Mom::NotSameCheck.new(cached_type , current_type, ok_label)
end
def build_type_cache_update
Mom::SlotLoad.new([dynamic_call.cache_entry, :cached_type] , [:message , :receiver , :type])
end
def build_method_cache_update(in_method)
receiver = SymbolConstant.new(@name)
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
end
end