[squeak-dev] 30 bit unboxed floats

David T. Lewis lewis at mail.msen.com
Mon Oct 18 23:24:28 UTC 2010


On Mon, Oct 18, 2010 at 06:31:15PM -0300, Jecel Assumpcao Jr. wrote:
> We have had several discussions about the tags in Squeak. xxxxxx1 is a
> SmallInteger and xxxxxx00 is an object pointer, but xxxxxx10 is not
> generally used. In one of the previous discussions somebody did mention
> a very obscure case in which this is actually used, but I can't find
> this email right now and don't remember the details. I do remember that
> at the time it seemed to me that it wouldn't be hard to change this to
> free up the 10 tag for some other use.

There is no shortage of bits to use for flagging immediate values.

Treating an object memory pointer as a (signed) sqInt of size 32 or 64,
then for a 32-bit object memory the valid pointer values are 0, 4, 8,
12 ... through end of memory. In the forseeable future, object memory
sizes of more than one or two GB are of no practical use. One or more
high order bits in the object memory pointer space are available for
other uses.

Thus:
  if pointer bitAt: 1 is set, then the pointer is an immediate integer,
  else if pointer < 0, then the pointer is an immediate float,
  else if pointer bitAt: 2 is set, then the pointer is an immediate character.

For immediate floats in a 32-bit object memory, bits 2 through 31 are
the float data. For a 64-bit object memory, bits 2 through 63 contain the
float data.

For immediate characters, bits 3 through 31 are available. Assuming tables
of 16-bit characters this could be further segmented into multiple character
tables, presumably with some image-side mapping support.

Dave




More information about the Squeak-dev mailing list