Skip to content
  • Philip Chimento's avatar
    object: Split ObjectPrototype from ObjectInstance · 4413e30d
    Philip Chimento authored
    This creates two separate classes, ObjectPrototype and ObjectInstance, so
    that we don't have to have a copy of prototype-only data in each
    ObjectInstance. This should save a lot of memory.
    
    There is one element common to both classes: a list of GClosures (for
    prototypes, these are vfuncs, and for instances, connected signals.)
    Since we can only create a JSClass with one private type, we use a common
    base class ObjectBase for that type. ObjectBase contains the list of
    closures and a means of distinguishing whether a particular ObjectBase
    pointer holds an ObjectInstance or ObjectPrototype. For this we use an
    ObjectPrototype pointer, which is null in ObjectPrototypes, and in
    ObjectInstances points to the associated prototype. (This scheme is
    similar to what we do in fundamental.cpp.)
    
    Both ObjectInstance and ObjectPrototype have an associated GObjectInfo
    and GType, but now these are stored only on the prototype.
    
    Note that we do not use RTTI and dynamic_cast<...
    4413e30d