bit more on booting of the space
This commit is contained in:
parent
2ccbea04b9
commit
5670f07eac
@ -21,12 +21,9 @@
|
|||||||
# Which resolves the dichotomy of objects on the stack or heap. Sama sama.
|
# Which resolves the dichotomy of objects on the stack or heap. Sama sama.
|
||||||
|
|
||||||
module Parfait
|
module Parfait
|
||||||
class Frame < Object
|
class Frame < List
|
||||||
def initialize locals , temps
|
def initialize
|
||||||
super()
|
super()
|
||||||
@locals = locals
|
|
||||||
@tmps = tmps
|
|
||||||
end
|
end
|
||||||
attr_accessor :locals , :tmps
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -44,6 +44,11 @@ module Parfait
|
|||||||
self.set( self.get_length + 1 , value)
|
self.set( self.get_length + 1 , value)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def first
|
||||||
|
return nil unless empty?
|
||||||
|
get(1)
|
||||||
|
end
|
||||||
|
|
||||||
# set the value at index.
|
# set the value at index.
|
||||||
# Lists start from index 1
|
# Lists start from index 1
|
||||||
def set( index , value)
|
def set( index , value)
|
||||||
|
@ -37,8 +37,14 @@ module Parfait
|
|||||||
# need a two phase init for the object space (and generally parfait) because the space
|
# need a two phase init for the object space (and generally parfait) because the space
|
||||||
# is an interconnected graph, so not everthing is ready
|
# is an interconnected graph, so not everthing is ready
|
||||||
def late_init
|
def late_init
|
||||||
@frames = 100.times.collect{ ::Parfait::Frame.new([],[])}
|
@frames = List.new_object
|
||||||
@messages = 100.times.collect{ ::Parfait::Message.new }
|
@messages = List.new_object
|
||||||
|
counter = 0
|
||||||
|
while( counter < 100)
|
||||||
|
@frames.push Frame.new_object
|
||||||
|
@messages.push Message.new_object
|
||||||
|
counter = counter + 1
|
||||||
|
end
|
||||||
@next_message = @messages.first
|
@next_message = @messages.first
|
||||||
@next_frame = @frames.first
|
@next_frame = @frames.first
|
||||||
end
|
end
|
||||||
@ -70,8 +76,8 @@ module Parfait
|
|||||||
end
|
end
|
||||||
|
|
||||||
def create_class name , superclass
|
def create_class name , superclass
|
||||||
c = Class.new_object(name , superclass)
|
|
||||||
raise "uups " if name.is_a? String
|
raise "uups " if name.is_a? String
|
||||||
|
c = Class.new_object(name , superclass)
|
||||||
@classes[name] = c
|
@classes[name] = c
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
@ -59,16 +59,20 @@ module Virtual
|
|||||||
class_mappings["Kernel"] = value_classes[2] #need for further booting
|
class_mappings["Kernel"] = value_classes[2] #need for further booting
|
||||||
class_mappings["Object"] = value_classes[3] #need for further booting
|
class_mappings["Object"] = value_classes[3] #need for further booting
|
||||||
|
|
||||||
|
# add space and instances which get created before the objects list
|
||||||
|
@space.add_object @space
|
||||||
|
@space.add_object @space.classes
|
||||||
|
@space.add_object @space.classes.keys
|
||||||
|
@space.add_object @space.classes.values
|
||||||
|
@space.add_object @space.objects
|
||||||
|
|
||||||
|
@space.late_init
|
||||||
|
|
||||||
# now update the layout on all objects created so far,
|
# now update the layout on all objects created so far,
|
||||||
# go through objects in space
|
# go through objects in space
|
||||||
@space.objects.each do | o |
|
@space.objects.each do | o |
|
||||||
o.init_layout
|
o.init_layout
|
||||||
end
|
end
|
||||||
# and go through the space instance variables which get created before the object list
|
|
||||||
@space.init_layout
|
|
||||||
@space.classes.init_layout
|
|
||||||
@space.objects.init_layout
|
|
||||||
@space.late_init
|
|
||||||
boot_functions!
|
boot_functions!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -10,7 +10,9 @@ module Virtual
|
|||||||
# instructions, thus defining a minimal set of instructions needed to implement oo.
|
# instructions, thus defining a minimal set of instructions needed to implement oo.
|
||||||
|
|
||||||
class Instruction
|
class Instruction
|
||||||
include Positioned
|
def to_s
|
||||||
|
Sof::Writer.write(self)
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
@ -34,11 +34,9 @@ module Virtual
|
|||||||
|
|
||||||
def initialize
|
def initialize
|
||||||
@parser = Parser::Salama.new
|
@parser = Parser::Salama.new
|
||||||
#the_end = Halt.new
|
|
||||||
@passes = [ "Virtual::SendImplementation" ]
|
@passes = [ "Virtual::SendImplementation" ]
|
||||||
# @message = Message.new(the_end , the_end , "Object" )
|
|
||||||
end
|
end
|
||||||
attr_reader :message , :passes , :space , :init , :main , :class_mappings
|
attr_reader :message , :passes , :space , :class_mappings
|
||||||
|
|
||||||
def run_passes
|
def run_passes
|
||||||
#TODO puts "INIT #{@init}"
|
#TODO puts "INIT #{@init}"
|
||||||
|
Loading…
Reference in New Issue
Block a user