starting to clear up slots
mostly docs
This commit is contained in:
12
lib/virtual/slots/frame_slot.rb
Normal file
12
lib/virtual/slots/frame_slot.rb
Normal file
@ -0,0 +1,12 @@
|
||||
module Virtual
|
||||
|
||||
# Slots in the Frame a re represented by instances of FrameSlot
|
||||
|
||||
# Slots in the Frame are local or temporary varialbes in a message
|
||||
class FrameSlot < Slot
|
||||
def initialize index , type = Unknown, value = nil
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
end
|
@ -1,5 +1,20 @@
|
||||
module Virtual
|
||||
# The message that is being processed has a layout as per the constant above
|
||||
|
||||
MESSAGE_CALLER = 0
|
||||
MESSAGE_RETURN_ADDRESS = 1
|
||||
MESSAGE_EXCEPTION_ADDRESS = 2
|
||||
MESSAGE_SELF = 3
|
||||
MESSAGE_NAME = 4
|
||||
MESSAGE_RETURN_VALUE = 5
|
||||
MESSAGE_FRAME = 6
|
||||
MESSAGE_PAYLOAD = 7
|
||||
|
||||
# The current Message is one of four objects the virtual machine knows
|
||||
#
|
||||
# Slots represent instance variables of objects, so MessageSlots
|
||||
# represent instance variables of Message objects.
|
||||
# The Message has a layout as per the constant above
|
||||
|
||||
class MessageSlot < Slot
|
||||
def initialize index , type = Unknown , value = nil
|
||||
super(index ,type , value )
|
||||
|
21
lib/virtual/slots/self_slot.rb
Normal file
21
lib/virtual/slots/self_slot.rb
Normal file
@ -0,0 +1,21 @@
|
||||
module Virtual
|
||||
|
||||
# Self (the receiver of the current message) is a Slot in the Message.
|
||||
# The current self in the current message and if the current message
|
||||
# want to send a message it puts the new self into the next_message.
|
||||
#
|
||||
# The slot in the Message is represented by instances of class Self
|
||||
# (and slots in the next_message by instances of NewSelf)
|
||||
#
|
||||
# Additionally the current Self is represented as it's own top-level object.
|
||||
# If self is an Object one can refer to it's instance variables as Slots in SelfSlot
|
||||
#
|
||||
# In Summary: class Self represents the self object and SelfSlot instances variables of
|
||||
# that object
|
||||
#
|
||||
class SelfSlot < Slot
|
||||
def initialize index , type = Unknown, value = nil
|
||||
super
|
||||
end
|
||||
end
|
||||
end
|
@ -2,7 +2,7 @@ module Virtual
|
||||
# A slot is a slot in an object. It is the storage location for a value.
|
||||
# (Remember, values are typed)
|
||||
# From a memory perspective a slot is an index into an array (the object)
|
||||
# But we are not modelling the array here, but the index into it.
|
||||
# We are not modelling the array here, but the index into it.
|
||||
|
||||
# Four known objects exist and those correspond to subclasses:
|
||||
# - the message that has been received: MessageSlot
|
||||
@ -21,15 +21,6 @@ module Virtual
|
||||
FRAME_REGISTER = :r2
|
||||
NEW_MESSAGE_REGISTER = :r3
|
||||
|
||||
MESSAGE_CALLER = 0
|
||||
MESSAGE_RETURN_ADDRESS = 1
|
||||
MESSAGE_EXCEPTION_ADDRESS = 2
|
||||
MESSAGE_SELF = 3
|
||||
MESSAGE_NAME = 4
|
||||
MESSAGE_RETURN_VALUE = 5
|
||||
MESSAGE_FRAME = 6
|
||||
MESSAGE_PAYLOAD = 7
|
||||
|
||||
attr_accessor :index , :type , :value
|
||||
|
||||
private #abstract base class
|
||||
@ -41,19 +32,9 @@ module Virtual
|
||||
end
|
||||
end
|
||||
|
||||
class FrameSlot < Slot
|
||||
def initialize index , type = Unknown, value = nil
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
class SelfSlot < Slot
|
||||
def initialize index , type = Unknown, value = nil
|
||||
super
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
require_relative "message_slot"
|
||||
require_relative "self_slot"
|
||||
require_relative "frame_slot"
|
||||
require_relative "new_message_slot"
|
||||
|
Reference in New Issue
Block a user