Skip to content
j4yk edited this page May 14, 2015 · 5 revisions

Reading a Squeak V3 image currently (2015-05-14) consists of the following steps:

in class spyvm.squeakimage.ImageReader...

  1. read image header into attributes of self
  2. read image body into a list of chunks (spyvm.squeakimage.ImageChunk), one for each object in the image
  3. build compact classes in self.compactclasses from self.chunks[self.specialobjectspointer].data[COMPACT_CLASS_ARR] (the Smalltalk Array of compact classes)
  4. initialize chunks as GenericObjects (g_objects), resolving pointers to other chunks
  5. initialize self.special_g_objects with existing special objects
  6. build empty wrapped objects (w_objects) for self.chunks and self.special_w_objects
  7. run RSqueakVM object model specific initialization (e.g. choose storage strategy, method fillin)
  8. populate space.objtable (dictionary of objects relevant for the VM)

Changes for Spur

There are some new image header fields. The image consists of segments (see class comment of SpurSegmentManager). The size of the first segment is in the image header.

In step 4, the pointer resolution must accomodate for the number swizzling due to segment bridges (connectors between segments), i.e. the preceeding bridge spans and bridge header sizes must be subtracted. Also new tag bits for immediate characters must be respected.

In step 2 the new header formats apply.

The new header format uses an indirection of class indexes, which are the same as classes' hash bits, instead of a direct pointer to the class. A suitable place must be found to recreate the class table (id/hash -> class) during Image reading, regardless of whether we also want to have this indirection in the RSqueakVM. In the current V3 reading code, the class reference is extracted (trivially) in step 4 and needed in step 7. Since the class table seems to be part of the image (see Spur (Image) Memory Layout), this might be a simple task.

Some objects can have 31 in their class index bits. This is the classIsItselfIndexPun and means that this object is its own class (sounds like ProtoObject). (SpurMemoryManager>>fetchClassOfNonImm:) There are more such puns and their purpose is to have their objects omitted from allInstances etc. For example, the arrays making up the class table have arrayClassIndexPun (16) in their class index bits.

Step 3 will be unnecessary as there are not compact classes in Spur and that array in the special objects will be empty.

Clone this wiki locally