Moving space to object class
away from Parfait module, as that gets collapsed Leaving shortcut outside parfait for now
This commit is contained in:
@ -1,25 +1,6 @@
|
||||
# Parfait is the ruby runtime
|
||||
module Parfait
|
||||
TYPE_INDEX = 0
|
||||
|
||||
class Object
|
||||
def self.memory_size
|
||||
8
|
||||
end
|
||||
def self.type_length
|
||||
1
|
||||
end
|
||||
def self.new( *args )
|
||||
object = self.allocate
|
||||
# have to grab the class, because we are in the ruby class not the parfait one
|
||||
cl = Parfait.object_space.get_class_by_name( self.name.split("::").last.to_sym)
|
||||
# and have to set the type before we let the object do anything. otherwise boom
|
||||
object.set_type cl.instance_type
|
||||
object.send :initialize , *args
|
||||
object
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
require_relative "parfait/object"
|
||||
@ -41,3 +22,32 @@ require_relative "parfait/type"
|
||||
require_relative "parfait/cache_entry"
|
||||
require_relative "parfait/message"
|
||||
require_relative "parfait/space"
|
||||
module Parfait
|
||||
# temporary shorthand getter for the space
|
||||
# See implementation, space is now moved to inside the Object class
|
||||
# (not module anymore), but there is a lot of code (about 100, 50/50 li/test)
|
||||
# still calling this old version and since it is shorter . . .
|
||||
def self.object_space
|
||||
Object.object_space
|
||||
end
|
||||
|
||||
class Object
|
||||
# redefine the runtime version
|
||||
def self.new( *args )
|
||||
object = self.allocate
|
||||
# have to grab the class, because we are in the ruby class not the parfait one
|
||||
cl = Parfait.object_space.get_class_by_name( self.name.split("::").last.to_sym)
|
||||
# and have to set the type before we let the object do anything. otherwise boom
|
||||
object.set_type cl.instance_type
|
||||
object.send :initialize , *args
|
||||
object
|
||||
end
|
||||
|
||||
# Setter fo the boot process, only at runtime.
|
||||
# only one space exists and it is generated at compile time, not runtime
|
||||
def self.set_object_space( space )
|
||||
@object_space = space
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user