2017-03-23 |
Paul Boddie |
file
changeset
files
shortlog
|
Represent integers as __attr values with bit 0 set. Since pointers must be
aligned (to four-byte boundaries on many modern systems, maybe two-byte
boundaries on older or embedded systems, eight-byte boundaries on some 64-bit
systems), any value with bit 0 set will not be referencing an object.
This avoids allocating objects for integers and instead just allows them to be
passed around. Bit 0 needs to be tested when attributes are accessed, and for
integers, a common instance is employed to provide any instance attributes,
an instance table reference and a reference to the integer class. |
integers-as-tagged-attrs |