Adding a new imediate type

Bryce Kampjes bryce at kampjes.demon.co.uk
Tue Jan 3 20:29:54 UTC 2006


Hans-Martin Mosner writes:
 > 
 > That's exactly how my code works. There are 2 tag bits: The SmallInteger 
 > bit and the Immediate bit. For SmallIntegers, the higher 30 bites are 
 > the 2's complement value. For non-SmallInteger immediates, 4 more bits 
 > are used to designate a class, so there are 26 bits of value left. Of 
 > course, you can designate the same class to different bit patterns in 
 > that 4 bit index, resulting in wider values for less classes.

Please don't extend the tag bits. It'll complicate message sends, the
code sequence required to find an object's class is already horrible.
Class checks are required for many operations including message sends
while new immediates will only benefit themselves. Hurting the general
case is not often a good optimisation.

It would be nice to get rid of compact classes, then there would only
be two cases to consider. This doesn't matter for the interpreter, but
does make a big difference for compiled code where class checking
sequences are duplicated every time they are used.

Bryce



More information about the Squeak-dev mailing list