move space accesor to boot_space
This commit is contained in:
parent
dd82095cca
commit
0b65e5840e
@ -49,7 +49,7 @@ module Ast
|
||||
class ModuleName < NameExpression
|
||||
|
||||
def compile method , message
|
||||
clazz = ::Virtual::Object.space.get_or_create_class name
|
||||
clazz = ::Virtual::BootSpace.space.get_or_create_class name
|
||||
raise "uups #{clazz}.#{name}" unless clazz
|
||||
#class qualifier, means call from metaclass
|
||||
#clazz = clazz.meta_class
|
||||
@ -61,7 +61,7 @@ module Ast
|
||||
# attr_reader :string
|
||||
def compile method , message
|
||||
value = Virtual::StringConstant.new(string)
|
||||
::Virtual::Object.space.add_object value
|
||||
::Virtual::BootSpace.space.add_object value
|
||||
value
|
||||
end
|
||||
end
|
||||
|
@ -9,7 +9,7 @@ module Ast
|
||||
r = receiver ? receiver.compile(method,message) : Virtual::Self.new()
|
||||
new_method = Virtual::MethodDefinition.new(name , args , r )
|
||||
new_method.class_name = r.is_a?(BootClass) ? r.name : method.class_name
|
||||
clazz = Virtual::Object.space.get_or_create_class(new_method.class_name)
|
||||
clazz = Virtual::BootSpace.space.get_or_create_class(new_method.class_name)
|
||||
clazz.add_instance_method new_method
|
||||
|
||||
#frame = frame.new_frame
|
||||
|
@ -20,7 +20,7 @@ module Ast
|
||||
|
||||
class ClassExpression < ModuleExpression
|
||||
def compile method , message
|
||||
clazz = ::Virtual::Object.space.get_or_create_class name
|
||||
clazz = ::Virtual::BootSpace.space.get_or_create_class name
|
||||
puts "Created class #{clazz.name.inspect}"
|
||||
# context.current_class = clazz
|
||||
expressions.each do |expression|
|
||||
|
@ -18,5 +18,5 @@ module Register
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual::Object.space.add_pass_after CallImplementation , SetImplementation
|
||||
Virtual::BootSpace.space.add_pass_after CallImplementation , SetImplementation
|
||||
end
|
||||
|
@ -11,5 +11,5 @@ module Register
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual::Object.space.add_pass_after GetImplementation, Virtual::SendImplementation
|
||||
Virtual::BootSpace.space.add_pass_after GetImplementation, Virtual::SendImplementation
|
||||
end
|
||||
|
@ -17,5 +17,5 @@ module Register
|
||||
end
|
||||
end
|
||||
end
|
||||
Virtual::Object.space.add_pass_after SetImplementation , GetImplementation
|
||||
Virtual::BootSpace.space.add_pass_after SetImplementation , GetImplementation
|
||||
end
|
||||
|
@ -39,6 +39,14 @@ module Virtual
|
||||
end
|
||||
end
|
||||
|
||||
def self.space
|
||||
if defined? @@space
|
||||
@@space
|
||||
else
|
||||
@@space = BootSpace.new
|
||||
end
|
||||
end
|
||||
|
||||
# Passes are initiated empty and added to by anyone who want (basically)
|
||||
# Even linking and assembly are passes and so there are quite a few system passes neccesary to result in a
|
||||
# working binary. Other than that, this is intentionally quite flexible
|
||||
|
@ -44,7 +44,7 @@ module Virtual
|
||||
class_for(MoveInstruction).new(value , self , :opcode => :mov)
|
||||
end
|
||||
def clazz
|
||||
Object.space.get_or_create_class(:String)
|
||||
BootSpace.space.get_or_create_class(:String)
|
||||
end
|
||||
end
|
||||
|
||||
|
@ -28,13 +28,6 @@ module Virtual
|
||||
Sof::Writer.write(self)
|
||||
end
|
||||
|
||||
def self.space
|
||||
if defined? @@space
|
||||
@@space
|
||||
else
|
||||
@@space = BootSpace.new
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
class Layout < Object
|
||||
|
@ -7,9 +7,9 @@ class HelloTest < MiniTest::Test
|
||||
machine = Virtual::Machine.boot
|
||||
expressions = machine.compile_main @string_input
|
||||
puts ""
|
||||
Virtual::Object.space.run_passes
|
||||
Virtual::BootSpace.space.run_passes
|
||||
puts Sof::Writer.write(expressions)
|
||||
# puts Sof::Writer.write(Virtual::Object.space)
|
||||
# puts Sof::Writer.write(Virtual::BootSpace.space)
|
||||
end
|
||||
|
||||
def qtest_simplest_function
|
||||
|
Loading…
Reference in New Issue
Block a user