From 21177bd7ced15aceb619885c4ee3b82242e91cec Mon Sep 17 00:00:00 2001 From: Torsten Ruger Date: Fri, 19 Sep 2014 19:11:30 +0300 Subject: [PATCH] add a list of symbols to boot space --- lib/register/assembler.rb | 5 ++++- lib/virtual/boot_space.rb | 18 ++++++++++++------ 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/lib/register/assembler.rb b/lib/register/assembler.rb index d0f0c19d..1396357a 100644 --- a/lib/register/assembler.rb +++ b/lib/register/assembler.rb @@ -110,7 +110,7 @@ module Register end def assemble_BootSpace(space) - assemble_self(space , [space.classes,space.objects] ) + assemble_self(space , [space.classes,space.objects, space.symbols,space.messages,space.frames] ) end def assemble_BootClass(clazz) @@ -179,6 +179,9 @@ module Register def add_BootSpace(space) add_object(space.classes) add_object(space.objects) + add_object(space.symbols) + add_object(space.messages) + add_object(space.frames) end def add_BootClass(clazz) diff --git a/lib/virtual/boot_space.rb b/lib/virtual/boot_space.rb index 625de98f..0775ad40 100644 --- a/lib/virtual/boot_space.rb +++ b/lib/virtual/boot_space.rb @@ -22,9 +22,12 @@ module Virtual @main = Virtual::CompiledMethod.new("main" , [] ) #global objects (data) @objects = [] + @symbols = [] + @messages = [] + @frames = [] @passes = [ Virtual::SendImplementation ] end - attr_reader :main , :classes , :objects + attr_reader :main , :classes , :objects , :symbols,:messages,:frames def run_passes @passes.each do |pass| @@ -91,16 +94,19 @@ module Virtual end end - @@SPACE = { :names => [:classes,:objects] , :types => [Virtual::Reference,Virtual::Reference]} + @@SPACE = { :names => [:classes,:objects,:symbols,:messages,:frames] , + :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference]} def layout @@SPACE end # Objects are data and get assembled after functions def add_object o - return if @objects.include? o -# raise "must be derived from Code #{o.inspect}" unless o.is_a? Virtual::Code - @objects << o # TODO check type , no basic values allowed (must be wrapped) + return if @objects.include?(o) + @objects << o + if o.is_a? Symbol + @symbols << o + end end # this is the way to instantiate classes (not BootClass.new) @@ -115,7 +121,7 @@ module Virtual c end def mem_length - padded_words( 2 ) + padded_words( 5 ) end end end