there go the slots
addressing them now directly in get/set slot idea is still valid, but express objects not needed/used anymore
This commit is contained in:
parent
64a92fb9f4
commit
aaaef6e3d7
@ -17,7 +17,7 @@ module Phisol
|
|||||||
raise "value #{value}" #tbc
|
raise "value #{value}" #tbc
|
||||||
end
|
end
|
||||||
|
|
||||||
Virtual::Return.new( index )
|
return nil # statements don't reurn values, only expressions
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -8,7 +8,6 @@ require "virtual/parfait_adapter"
|
|||||||
require "phisol/compiler"
|
require "phisol/compiler"
|
||||||
require "virtual/instruction"
|
require "virtual/instruction"
|
||||||
require "virtual/method_source"
|
require "virtual/method_source"
|
||||||
require "virtual/slots/slot"
|
|
||||||
# the passes _are_ order dependant
|
# the passes _are_ order dependant
|
||||||
require "virtual/passes/minimizer"
|
require "virtual/passes/minimizer"
|
||||||
require "virtual/passes/collector"
|
require "virtual/passes/collector"
|
||||||
|
@ -1,22 +0,0 @@
|
|||||||
module Virtual
|
|
||||||
|
|
||||||
# Slots in the Frame a re represented by instances of FrameSlot
|
|
||||||
|
|
||||||
# Slots in the Frame are local or temporary variables in a message
|
|
||||||
class FrameSlot < Slot
|
|
||||||
def initialize index , type , value = nil
|
|
||||||
super(type, value)
|
|
||||||
@index = index
|
|
||||||
end
|
|
||||||
attr_reader :index
|
|
||||||
|
|
||||||
def to_s
|
|
||||||
"#{self.class.name}.new(#{index} , #{type}, #{value})"
|
|
||||||
end
|
|
||||||
|
|
||||||
def object_name
|
|
||||||
return :frame
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,54 +0,0 @@
|
|||||||
module Virtual
|
|
||||||
|
|
||||||
# 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 type , value = nil
|
|
||||||
super(type , value )
|
|
||||||
end
|
|
||||||
def object_name
|
|
||||||
:message
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# named classes exist for slots that often accessed
|
|
||||||
|
|
||||||
# Return is the return of MessageSlot
|
|
||||||
class Return < MessageSlot
|
|
||||||
def initialize type , value = nil
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# Self is the self in MessageSlot
|
|
||||||
class Self < MessageSlot
|
|
||||||
def initialize type , value = nil
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# MessageName of the current message
|
|
||||||
class MessageName < MessageSlot
|
|
||||||
def initialize type , value = nil
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# NewMessageName of the next message
|
|
||||||
class ArgSlot < MessageSlot
|
|
||||||
def initialize index , type , value = nil
|
|
||||||
@index = index
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
attr_reader :index
|
|
||||||
def to_s
|
|
||||||
"#{self.class.name}.new(#{index} , #{type}, #{value})"
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
|
|
||||||
end
|
|
@ -1,50 +0,0 @@
|
|||||||
module Virtual
|
|
||||||
|
|
||||||
# The next Message is one of four objects the virtual machine knows
|
|
||||||
#
|
|
||||||
# Slots represent instance variables of objects, so NewMessageSlots
|
|
||||||
# represent instance variables of NewMessage objects.
|
|
||||||
# The Message has a layout as per the constant above
|
|
||||||
|
|
||||||
class NewMessageSlot < Slot
|
|
||||||
def initialize type , value = nil
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
def object_name
|
|
||||||
:new_message
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# named classes exist for slots that often accessed
|
|
||||||
|
|
||||||
# NewReturn is the return of NewMessageSlot
|
|
||||||
class NewReturn < NewMessageSlot
|
|
||||||
def initialize type , value = nil
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# NewSelf is the self of NewMessageSlot
|
|
||||||
class NewSelf < NewMessageSlot
|
|
||||||
def initialize type , value = nil
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# NewMessageName of the next message
|
|
||||||
class NewMessageName < NewMessageSlot
|
|
||||||
def initialize type , value = nil
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
# NewMessageName of the next message
|
|
||||||
class NewArgSlot < NewMessageSlot
|
|
||||||
def initialize index , type , value = nil
|
|
||||||
@index = index
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
attr_reader :index
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
|
@ -1,26 +0,0 @@
|
|||||||
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 SelfsSlot
|
|
||||||
#
|
|
||||||
# In Summary: class Self represents the self object and SelfsSlot instances variables of
|
|
||||||
# that object
|
|
||||||
#
|
|
||||||
class SelfsSlot < Slot
|
|
||||||
def initialize index , type , value = nil
|
|
||||||
@index = index
|
|
||||||
super( type , value )
|
|
||||||
end
|
|
||||||
attr_reader :index
|
|
||||||
def object_name
|
|
||||||
:self
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
@ -16,31 +16,5 @@ module Virtual
|
|||||||
# Slot has a lot of small subclasses
|
# Slot has a lot of small subclasses
|
||||||
# Names for the slots avoid indexes
|
# Names for the slots avoid indexes
|
||||||
|
|
||||||
class Slot < Object
|
|
||||||
|
|
||||||
# the name of the object of a slot is a symbol that represents what the class name describes
|
|
||||||
# ie it is one of :message , :self , :frame , :new_message
|
|
||||||
# one of the objects the machine works on.
|
|
||||||
def object_name
|
|
||||||
raise "abstract called #{self}"
|
|
||||||
end
|
|
||||||
|
|
||||||
attr_accessor :type , :value
|
|
||||||
|
|
||||||
def to_s
|
|
||||||
"#{self.class.name}.new(#{type}, #{value})"
|
|
||||||
end
|
|
||||||
private #abstract base class
|
|
||||||
|
|
||||||
def initialize type , value
|
|
||||||
@type = type
|
|
||||||
@value = value
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
||||||
require_relative "message_slot"
|
|
||||||
require_relative "selfs_slot"
|
|
||||||
require_relative "frame_slot"
|
|
||||||
require_relative "new_message_slot"
|
|
Loading…
Reference in New Issue
Block a user