diff --git a/lib/register/builtin/kernel.rb b/lib/register/builtin/kernel.rb index 9020a5ee..e24e6328 100644 --- a/lib/register/builtin/kernel.rb +++ b/lib/register/builtin/kernel.rb @@ -12,7 +12,7 @@ module Builtin # so it is responsible for initial setup (and relocation) def __init__ context function = Virtual::CompiledMethod.new(:__init__ , [] , Virtual::Integer) - clazz = Virtual::Space.space.get_or_create_class :Kernel + clazz = Virtual::Machine.instance.space.get_or_create_class :Kernel method = clazz.resolve_method :main me = Virtual::Self.new(Virtual::Reference) code = Virtual::Set.new(Virtual::Self.new(me.type), me) @@ -20,7 +20,7 @@ module Builtin function.add_code Virtual::MethodCall.new(method) return function end - def putstring context + def putstring context function = Virtual::CompiledMethod.new(:putstring , [] ) return function ret = Virtual::RegisterMachine.instance.write_stdout(function) diff --git a/lib/register/builtin/object.rb b/lib/register/builtin/object.rb index 16aaf8bb..b8cd0ef7 100644 --- a/lib/register/builtin/object.rb +++ b/lib/register/builtin/object.rb @@ -29,7 +29,7 @@ module Builtin var_name = get_function.args.first return_to = get_function.return_type - index_function = ::Virtual::Space.space.get_or_create_class(:Object).resolve_method(:index_of) + index_function = ::Virtual::Machine.instance.space.get_or_create_class(:Object).resolve_method(:index_of) # get_function.push( [me] ) # index = get_function.call( index_function ) diff --git a/lib/virtual/compiler/basic_expressions.rb b/lib/virtual/compiler/basic_expressions.rb index cd4a5e7e..de42242e 100644 --- a/lib/virtual/compiler/basic_expressions.rb +++ b/lib/virtual/compiler/basic_expressions.rb @@ -73,7 +73,7 @@ module Virtual def self.compile_string expression , method value = StringConstant.new(expression.string) to = Return.new(Reference , value) - Space.space.add_object value + Machine.instance.space.add_object value method.add_code Set.new( to , value ) to end diff --git a/lib/virtual/compiler/function_expression.rb b/lib/virtual/compiler/function_expression.rb index 57e7d3dc..f4465d98 100644 --- a/lib/virtual/compiler/function_expression.rb +++ b/lib/virtual/compiler/function_expression.rb @@ -8,8 +8,8 @@ module Virtual end r = expression.receiver ? Compiler.compile(expression.receiver, method ) : Self.new() new_method = CompiledMethod.new(expression.name , args , r ) - new_method.class_name = r.is_a?(BootClass) ? r.name : method.class_name - clazz = Space.space.get_or_create_class(new_method.class_name) + new_method.class_name = r.is_a?(Parfait::Class) ? r.name : method.class_name + clazz = Machine.instance.space.get_or_create_class(new_method.class_name) clazz.add_instance_method new_method #frame = frame.new_frame diff --git a/lib/virtual/machine.rb b/lib/virtual/machine.rb index 40ff5dce..aba76ea5 100644 --- a/lib/virtual/machine.rb +++ b/lib/virtual/machine.rb @@ -117,7 +117,7 @@ module Virtual [:get , :set , :puts].each do |f| obj.add_instance_method Builtin::String.send(f , nil) end - obj = get_or_create_class :Array + obj = space.get_or_create_class :Array [:get , :set , :push].each do |f| obj.add_instance_method Builtin::Array.send(f , nil) end diff --git a/lib/virtual/passes/send_implementation.rb b/lib/virtual/passes/send_implementation.rb index 4befee8c..a76207cd 100644 --- a/lib/virtual/passes/send_implementation.rb +++ b/lib/virtual/passes/send_implementation.rb @@ -26,7 +26,7 @@ module Virtual else # note: this is the current view: call internal send, even the method name says else # but send is "special" and accesses the internal method name and resolves. - kernel = Virtual::Space.space.get_or_create_class(:Kernel) + kernel = Virtual::Machine.instance.space.get_or_create_class(:Kernel) method = kernel.get_instance_method(:__send) new_codes << MethodCall.new( method ) raise "unimplemented #{code}"