move soml tests out, small cleanup

This commit is contained in:
Torsten Ruger
2016-12-06 15:08:29 +02:00
parent 5ac14ddccc
commit adca8b21c1
41 changed files with 32 additions and 21 deletions

View File

@ -10,8 +10,8 @@
# may be added to any object at run-time.
# An Object carries the data for the instance variables it has.
# The type lists the names of the instance variables
# The class keeps a list of instance methods, these have a name and code
# The Type lists the names of the instance variables
# The Class keeps a list of instance methods, these have a name and code
module Parfait
class Class < Object

View File

@ -21,10 +21,11 @@ module Parfait
# At compile time we fake memory by using a global array for pages
def self.new *args
object = self.allocate
#HACK, but used to do the adapter in the init, bu that is too late now
object.fake_init if object.respond_to?(:fake_init) # at compile, not run-time
object.compile_time_init if object.respond_to?(:compile_time_init)
# have to grab the class, because we are in the ruby class not the parfait one
cl = Space.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
@ -35,7 +36,7 @@ module Parfait
include Padding
include Positioned
def fake_init
def compile_time_init
@memory = Array.new(16)
@position = nil
self # for chaining

View File

@ -6,7 +6,7 @@
# The Type allows the mapping of names to index.
# The Type of an object describes the memory layout of the object. In a c analogy, it is the
# information defined in a struct.
# information defined in a struct.
# The Type is a list of the names of instance variables, and their value types (int etc).
#
# Every object has a Type to describe it, so it's *first* instance variable is **always**
@ -19,13 +19,19 @@
# But Objects must also be able to carry methods themselves (ruby calls singleton_methods)
# and those too are stored in the Type (both type and class include behaviour)
# In other words, the Type is a list of names and value types that describe
# the values stored in an actual object.
# The object is an List of values of length n and
# the Type is an List of names and value tpyes of length n ,
# plus class reference and methods reference
# The object is an List of values of length n
# The Type is a list of n names and n types that describe the values stored in an actual object.
# Together they turn the object into a hash like structure
# For types to be a useful concept, they have to be unique and immutable. Any "change", like adding
# a name/type pair, will result in a new instance.
# The Type class carries a hash of types of the systems, which is used to ensure that
# there is only one instance of every type. Hash and equality are defined on type
# for this to work.
module Parfait
class Type < Object
attribute :object_class