load arg type directly into the object

Was going through the method, but the type is just as constant and
saves 2 instructions 4 every call
This commit is contained in:
Torsten Ruger 2017-01-04 21:34:51 +02:00
parent 78f7420ef7
commit 9d36d72ee5
2 changed files with 2 additions and 4 deletions

View File

@ -17,6 +17,7 @@ module Register
message_ind = Register.resolve_to_index( :space , :first_message )
compiler.add_slot_to_reg( "__init__ load 1st message" , space_reg , message_ind , :message)
compiler.add_reg_to_slot( "__init__ store Space in message", space_reg , :message , :receiver)
#fixme: should add arg type here, as done in call_site (which this sort of is)
exit_label = Register.label("_exit_label for __init__" , "#{compiler.type.object_class.name}.#{compiler.method.name}" )
ret_tmp = compiler.use_reg(:Label)
compiler.add_load_constant("__init__ load return", exit_label , ret_tmp)

View File

@ -63,10 +63,7 @@ module Typed
# next arg type
args_reg = use_reg(:Type , method.arguments )
list_reg = use_reg(:NamedList , arguments )
add_load_constant("#{name} load methods", method , args_reg)
args_type_index = method.get_type().variable_index(:arguments)
raise args_type_index.to_s unless args_type_index == 6
add_slot_to_reg( "#{name} get args type from method" , args_reg , args_type_index , args_reg )
add_load_constant("#{name} load arguments type", method.arguments , args_reg)
add_slot_to_reg( "#{name} get args from method" , :new_message , :arguments , list_reg )
add_reg_to_slot( "#{name} store args type in args" , args_reg , list_reg , 1 )
end