[Newbies] true/false defined where?
K. K. Subramaniam
subbukk at gmail.com
Wed Aug 6 02:58:06 UTC 2008
On Tuesday 05 Aug 2008 6:39:01 pm Sean Allen wrote:
> I have a feeling the secret to unraveling that confusion comes from
> 'true and false and some of the very few objects known to the VM'
An object in Squeak contains between two to three header words (object
descriptor, class and size). Some objects which are required to bootstrap an
image into existence or which are frequently exchanged between VM and image
are held in a array and its index is packed into the descriptor word itself
leading to a compact one-word header.
oop -> the object whose class is number 5 size 4 words
oop -> the object whose class is at 0x3058587474 size 4 words
When the VM encounters an object descriptor of the first type, it will look up
the class number in the global variable, specialObjectsArray to extract the
class pointer. The number and order of elements in this array has to be
finalized at the time of compiling VM code. This explains the "objects known
to the VM" part. If the number or order of indexed objects are changed in
Image, a new VM has to be compiled with these changes.
How does the VM know where to find specialObjectsArray? from the header in the
image file (fifth 32-bit slot).
More information about the Beginners