move builtin to register, where it belongs

This commit is contained in:
Torsten Ruger 2015-05-04 11:12:31 +03:00
parent 3659cb4b81
commit 92bbd70c77
7 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,5 @@
require_relative "boot_class" require_relative "boot_class"
require "builtin/object" require "register/builtin/object"
module Virtual module Virtual
# The BootSpace contains all objects for a program. In functional terms it is a program, but in oo # The BootSpace contains all objects for a program. In functional terms it is a program, but in oo
@ -10,16 +10,16 @@ module Virtual
# While data ususally would live in a .data section, we may also "inline" it into the code # While data ususally would live in a .data section, we may also "inline" it into the code
# in an oo system all data is represented as objects # in an oo system all data is represented as objects
class BootSpace < Virtual::ObjectConstant class BootSpace < Virtual::ObjectConstant
def initialize def initialize
super() super()
@classes = Parfait::Hash.new @classes = Parfait::Hash.new
#global objects (data) #global objects (data)
@objects = [] @objects = []
@symbols = [] @symbols = []
@frames = 100.times.collect{ ::Frame.new } @frames = 100.times.collect{ ::Frame.new }
@messages = 100.times.collect{ ::Message.new } @messages = 100.times.collect{ ::Message.new }
@next_message = @messages.first @next_message = @messages.first
@next_frame = @frames.first @next_frame = @frames.first
@ -36,7 +36,7 @@ module Virtual
#puts "running #{pass_class}" #puts "running #{pass_class}"
all.each do |block| all.each do |block|
pass = eval pass_class pass = eval pass_class
raise "no such pass-class as #{pass_class}" unless pass raise "no such pass-class as #{pass_class}" unless pass
pass.new.run(block) pass.new.run(block)
end end
end end
@ -71,10 +71,10 @@ module Virtual
end end
# boot the classes, ie create a minimal set of classes with a minimal set of functions # boot the classes, ie create a minimal set of classes with a minimal set of functions
# minimal means only that which can not be coded in ruby # minimal means only that which can not be coded in ruby
# CompiledMethods are grabbed from respective modules by sending the method name. This should return the # CompiledMethods are grabbed from respective modules by sending the method name. This should return the
# implementation of the method (ie a method object), not actually try to implement it (as that's impossible in ruby) # implementation of the method (ie a method object), not actually try to implement it (as that's impossible in ruby)
def boot_classes! def boot_classes!
# very fiddly chicken 'n egg problem. Functions need to be in the right order, and in fact we have to define some # very fiddly chicken 'n egg problem. Functions need to be in the right order, and in fact we have to define some
# dummies, just for the other to compile # dummies, just for the other to compile
obj = get_or_create_class :Object obj = get_or_create_class :Object
[:index_of , :_get_instance_variable , :_set_instance_variable].each do |f| [:index_of , :_get_instance_variable , :_set_instance_variable].each do |f|
@ -107,7 +107,7 @@ module Virtual
end end
end end
@@SPACE = { :names => [:classes,:objects,:symbols,:messages, :next_message , :next_frame] , @@SPACE = { :names => [:classes,:objects,:symbols,:messages, :next_message , :next_frame] ,
:types => [Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference]} :types => [Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference,Virtual::Reference]}
def layout def layout
@@SPACE @@SPACE