Adding a word to Squeak's object header

Dan Ingalls Dan at SqueakLand.org
Fri Aug 24 05:14:59 UTC 2001


"Stephen Pair" <spair at advantive.com>  wrote...

>I'm trying to add 4 bytes to the object header (mainly for educational
>purposes)...but I'm having a terrible time getting it work.  I've been
>able to use the SystemTracer to produce what I think is a clone with the
>extra header bytes inserted (and I've successfully tested a regular
>clone), however, I can't get it to run successfully on a modified VM.
>
>I've tried adding the new header word before the oop (oop - 4) and
>sliding the class and size headers further back.  I've also tried
>increasing BaseHeaderSize to 8 (from 4) such that the new word follows
>the normal base header.  Which is the best approach?  I've picked
>through almost all of the methods in ObjectMemory and Interpreter
>looking for hardcoded assumptions about the structure of the header.
>What about the plugins?  Should I be looking in there as well for code
>that hardcodes object header offsets?
>
>I'm not familiar enough with the VM code to know what kind of snafus I
>should be looking for.  I'm hoping someone who's been there and done it
>before might have some tips.

Stephen -

You go, guy!

This is likely a tough one to do.  There are probably lots of places that expect the base header to be where the oop points, and it may be hard to track them all down.

If you increase BaseHeaderSize, I think you still want to leave the base header at 0, and insert your new word at -4.

Another approach would be to force all headers to be 4 (count 'em) words long -- like the current three-word headers plus your additional word at oop-12.  Even before this, you may want to get rid of compact classes, but I think they'll still work with big headers (and I think the quick checks for contexts expect they have compact class fields).   Hope this helps.

I assume you are running the simulator to try it out.  Check the integrity of the entire memory between every bytecode at first.

Good luck.

	- Dan
-- 




More information about the Squeak-dev mailing list