more renaming of frame
This commit is contained in:
@ -2,7 +2,7 @@ require_relative "attributed"
|
||||
|
||||
module Arm
|
||||
|
||||
# A Machines main responsibility in the framework is to instantiate Instructions
|
||||
# A Machines main responsibility in the named_listwork is to instantiate Instructions
|
||||
|
||||
# Value functions are mapped to machines by concatenating the values class name + the methd name
|
||||
# Example: IntegerValue.plus( value ) -> Machine.signed_plus (value )
|
||||
|
@ -115,7 +115,7 @@ module Register
|
||||
def type_names
|
||||
{ :Word => {:char_length => :Integer} ,
|
||||
:List => {:indexed_length => :Integer} ,
|
||||
:Message => { :next_message => :Message, :receiver => :Object, :frame => :NamedList ,
|
||||
:Message => { :next_message => :Message, :receiver => :Object, :named_list => :NamedList ,
|
||||
:return_address => :Integer, :return_value => :Integer,
|
||||
:caller => :Message , :name => :Word , :indexed_length => :Integer },
|
||||
:MetaClass => {:object => :Object},
|
||||
|
@ -99,7 +99,7 @@ module Register
|
||||
|
||||
# if a symbol is given, it may be one of the four objects that the vm knows.
|
||||
# These are mapped to register references.
|
||||
# The valid symbols (:message, :self,:frame,:new_message) are the same that are returned
|
||||
# The valid symbols (:message, :self,:named_list,:new_message) are the same that are returned
|
||||
# by the slots. All data (at any time) is in one of the instance variables of these four
|
||||
# objects. Register defines module methods with the same names (and _reg)
|
||||
def self.resolve_to_register reference
|
||||
|
@ -19,13 +19,13 @@ module Typed
|
||||
# TODO, check type @method.arguments[index].type
|
||||
return Register.set_slot(statement , value , :message , Parfait::Message.get_indexed(index) )
|
||||
end
|
||||
# or a local so it is in the frame
|
||||
# or a local so it is in the named_list
|
||||
index = @method.has_local( name )
|
||||
return nil unless index
|
||||
# TODO, check type @method.locals[index].type
|
||||
frame = use_reg(:NamedList)
|
||||
add_code Register.get_slot(statement , :message , :frame , frame )
|
||||
return Register.set_slot(statement , value , frame , Parfait::NamedList.get_indexed(index) )
|
||||
named_list = use_reg(:NamedList)
|
||||
add_code Register.get_slot(statement , :message , :named_list , named_list )
|
||||
return Register.set_slot(statement , value , named_list , Parfait::NamedList.get_indexed(index) )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
@ -17,7 +17,7 @@ module Typed
|
||||
add_code Register.get_slot(statement , :message , Parfait::Message.get_indexed(index), ret )
|
||||
return ret
|
||||
end
|
||||
# or a local so it is in the frame
|
||||
# or a local so it is in the named_list
|
||||
handle_local(statement)
|
||||
end
|
||||
|
||||
@ -26,10 +26,10 @@ module Typed
|
||||
def handle_local statement
|
||||
index = @method.has_local( statement.name )
|
||||
raise "must define variable '#{statement.name}' before using it" unless index
|
||||
frame = use_reg :NamedList
|
||||
add_code Register.get_slot(statement , :message , :frame , frame )
|
||||
named_list = use_reg :NamedList
|
||||
add_code Register.get_slot(statement , :message , :named_list , named_list )
|
||||
ret = use_reg @method.locals_type( index )
|
||||
add_code Register.get_slot(statement , frame , Parfait::NamedList.get_indexed(index), ret )
|
||||
add_code Register.get_slot(statement , named_list , Parfait::NamedList.get_indexed(index), ret )
|
||||
return ret
|
||||
end
|
||||
|
||||
|
@ -9,7 +9,7 @@
|
||||
|
||||
module Parfait
|
||||
class Message < Object
|
||||
attributes [:next_message , :receiver , :frame , :return_address ]
|
||||
attributes [:next_message , :receiver , :named_list , :return_address ]
|
||||
attributes [:return_value, :caller , :name ]
|
||||
|
||||
include Indexed
|
||||
@ -17,7 +17,7 @@ module Parfait
|
||||
|
||||
def initialize next_m
|
||||
self.next_message = next_m
|
||||
self.frame = NamedList.new()
|
||||
self.named_list = NamedList.new()
|
||||
self.caller = nil
|
||||
super()
|
||||
end
|
||||
|
@ -8,10 +8,10 @@
|
||||
# A Message with is arguments, and a NamedList make up the two sides of message passing:
|
||||
# A Message (see details there) is created by the caller and control is transferred
|
||||
# A NamedList is created by the receiver
|
||||
# PS: it turns out that both messages and frames are created at compile, not run-time, and
|
||||
# just constantly reused. Each message has a frame object ready and is also linked
|
||||
# PS: it turns out that both messages and named_lists are created at compile, not run-time, and
|
||||
# just constantly reused. Each message has a named_list object ready and is also linked
|
||||
# to the next message.
|
||||
# The better way to say above is that a message is *used* by the caller, and a frame by the callee.
|
||||
# The better way to say above is that a message is *used* by the caller, and a named_list by the callee.
|
||||
|
||||
# Also at runtime Messages and NamedLists remain completely "normal" objects.
|
||||
# Ie they have have type and instances and so on.*
|
||||
|
Reference in New Issue
Block a user