[squeak-dev] Using class indexes instead of reference in oop header (in COG)

Igor Stasenko siguctua at gmail.com
Sun Aug 31 14:37:02 UTC 2008


Hi all,

I wanted to ask Eliot about some details how he planning to use new
object format in Cog.
I think it may be interesting to others, so i posted it here.

At ESUG, Eliot mentioned that new object format will be 64 bit
(regadless of platform), and he will use a class indexes (pointing to
entry in a global classes table) in header instead of direct class
oop.
Currently, in Squeak VM same principle is used for so-called compact
classes, where in oop header is stored an index of compact classes
array entry, which allowing to have a smallest possible oop header (32
bits).

So, in Cog, to determine an oop class, first it reads an index from
its header, and then reads a class oop from classes global table.
But you need a reverse operation as well - translating class oop into index.
Every time you doing #basicNew , or #primitiveChangeClass , you need
to determine a class index by its oop value.

So, the question is how this will be done?

Also, some classes may die, and obviously VM needs to do a compaction
of global classes table at some point, to prevent maintaining a big
table where only few of entries is used.
Suppose i created 1000+1 classes  => each class gets own index in table.
Then first 1000 classes is gone (when user uninstalling something).
Now you having 1000 free entries in table. But last one is still in
use, and if you want to make table more compact it would require to
visit each instance of that class and set a new index value.


-- 
Best regards,
Igor Stasenko AKA sig.



More information about the Squeak-dev mailing list