Issues creating instance of SmallInteger

Michael Haupt mhaupt at gmail.com
Fri May 12 17:41:44 UTC 2006


John,

On 5/12/06, John M McIntosh <johnmci at smalltalkconsulting.com> wrote:
> In Squeak we use 2 bits of the 32 in 32bit Squeak, 1 bit
> for a tag for the GC logic, and the other bit to signify if this
> object is a SmallInteger.
>
> xxxxxxxx00 -> object reference (tag bit not set; divisible by four)
> xxxxxxxx10 -> Unused (tag bit not set; but not a valid pointer)
> xxxxxxxx01 -> SmallInteger (tag bit set)
> xxxxxxxx11 -> SmallInteger (tag bit set)

I was not aware of that GC flag bit, but I had actually been wondering
why one bit was "wasted" when pointers/references are word-aligned...
Can you point me to a place in the image where that is made clear?

(I told some students of mine about this issue just yesterday and
omitted these GC details, but they should be updated, I think.)

> Lastly, I'm afraid we do create many copies of 42 since people do
> alter them.

I don't understand this. The oop representing 42 always has the same
shape, hasn't it? Just having it lying around in numerous places all
over the image does not mean creating a copy... after all, it's
identical with all the others.

And if 42 is altered, it's not 42 any more, but, say 23.

Am I missing something?

Best,

Michael



More information about the Squeak-dev mailing list