renamed adapter

seemed more appropriate as it makes the
parfait work in the vm (i.e. adapts parfait)
This commit is contained in:
Torsten Ruger 2015-05-21 21:49:47 +03:00
parent 422ec64105
commit a28b41a5f5
3 changed files with 21 additions and 2 deletions

View File

@ -12,4 +12,4 @@ require "parfait/frame"
require "parfait/space" require "parfait/space"
#if we are in the ruby run-time / generating an executable #if we are in the ruby run-time / generating an executable
require "virtual/compile_parfait" require "virtual/parfait_adapter"

View File

@ -7,7 +7,7 @@ The run-time needs to contain quite a lot of functionality for a dynamic system.
And a large part of that functionality must actually be used at compile time too. And a large part of that functionality must actually be used at compile time too.
We reuse the Parfait code at compile-time, to create the data for the compiled vm. We reuse the Parfait code at compile-time, to create the data for the compiled vm.
To do this the vm (re) defines the object memory (in compile_parfait). To do this the vm (re) defines the object memory (in parfait_adapter).
To do the actual compiling we parse and compile the parfait code and inline it to To do the actual compiling we parse and compile the parfait code and inline it to
appropriate places (ie send, get_instance_variable etc). We have to inline to avoid recursion. appropriate places (ie send, get_instance_variable etc). We have to inline to avoid recursion.

View File

@ -6,11 +6,30 @@
module FakeMem module FakeMem
def initialize def initialize
if( self.class.name == "Parfait::Space")
puts "YES , I am SPACE"
end
@memory = [0,nil] @memory = [0,nil]
if Parfait::Space.object_space and Parfait::Space.object_space.objects
Parfait::Space.object_space.add_object self
puts "got it #{self.class.name}"
else
puts "it escaped #{self.class.name}"
end
end
def init_layout
class_name = self.class.name
puts "CLASS #{class_name}"
puts "Check for #{class_name}"
cl = Parfait::Space.space.get_class(class_name)
puts "found #{cl}" if cl
end end
end end
module Parfait module Parfait
Space.class_eval do
attr_accessor :vm_objects
end
# Objects memory functions. Object memory is 1 based # Objects memory functions. Object memory is 1 based
# but we implement it with ruby array (0 based) and use 0 as type-word # but we implement it with ruby array (0 based) and use 0 as type-word
# These are the same functions that Builtin implements at run-time # These are the same functions that Builtin implements at run-time