much ripples from changing the calling convention
See previous commit Now args and locals are arrays in the Message
This commit is contained in:
@ -27,7 +27,7 @@ module Typed
|
||||
end
|
||||
# TODO, check type @method.locals[index].type
|
||||
add_code Register.slot_to_reg(statement , :message , type , named_list )
|
||||
return Register.reg_to_slot(statement , value , named_list , index )
|
||||
return Register.reg_to_slot(statement , value , named_list , index + 1 ) # one for type
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -12,9 +12,11 @@ module Typed
|
||||
end
|
||||
# either an argument, so it's stored in message
|
||||
if( index = @method.has_arg(name))
|
||||
named_list = use_reg :NamedList
|
||||
ret = use_reg @method.argument_type(index)
|
||||
#puts "For #{name} at #{index} got #{@method.arguments.inspect}"
|
||||
add_code Register.slot_to_reg(statement , :message , index, ret )
|
||||
add_code Register.slot_to_reg("#{statement} load args" , :message , :arguments, named_list )
|
||||
add_code Register.slot_to_reg("#{statement} load #{name}" , named_list , index + 1, ret )
|
||||
return ret
|
||||
end
|
||||
# or a local so it is in the named_list
|
||||
@ -23,31 +25,33 @@ module Typed
|
||||
|
||||
private
|
||||
|
||||
def handle_local statement
|
||||
index = @method.has_local( statement.name )
|
||||
raise "must define variable '#{statement.name}' before using it" unless index
|
||||
def handle_local( statement )
|
||||
name = statement.name
|
||||
index = @method.has_local( name )
|
||||
raise "must define variable '#{name}' before using it" unless index
|
||||
named_list = use_reg :NamedList
|
||||
add_code Register.slot_to_reg(statement , :message , :locals , named_list )
|
||||
add_code Register.slot_to_reg("#{name} load locals" , :message , :locals , named_list )
|
||||
ret = use_reg @method.locals_type( index )
|
||||
add_code Register.slot_to_reg(statement , named_list , index, ret )
|
||||
add_code Register.slot_to_reg("#{name} load from locals" , named_list , index + 1, ret )
|
||||
return ret
|
||||
end
|
||||
|
||||
def handle_special_self(statement)
|
||||
ret = use_reg @type
|
||||
add_code Register.slot_to_reg(statement , :message , :receiver , ret )
|
||||
add_code Register.slot_to_reg("#{statement} load self" , :message , :receiver , ret )
|
||||
return ret
|
||||
end
|
||||
|
||||
def handle_special_space(statement)
|
||||
space = Parfait::Space.object_space
|
||||
reg = use_reg :Space , space
|
||||
add_code Register::LoadConstant.new( statement, space , reg )
|
||||
add_code Register::LoadConstant.new( "#{statement} load space", space , reg )
|
||||
return reg
|
||||
end
|
||||
|
||||
def handle_special_message(statement)
|
||||
reg = use_reg :Message
|
||||
add_code Register::RegisterTransfer.new( statement, Register.message_reg , reg )
|
||||
add_code Register::RegisterTransfer.new( "#{statement} load message", Register.message_reg , reg )
|
||||
return reg
|
||||
end
|
||||
end #module
|
||||
|
Reference in New Issue
Block a user