For example, if the LSB is 1, then the VALUE isn't a pointer - it's a Fixnum. This is why the maximum size of a Ruby Fixnum is one bit less than the pointer size on the machine.
For example, if the LSB is 1, then the VALUE isn't a pointer - it's a Fixnum. This is why the maximum size of a Ruby Fixnum is one bit less than the pointer size on the machine.
Not quite: Having hardware support for type tagging means the machine knows that some bits are reserved for the tag and will therefore do arithmetic in a tag-preserving fashion. The 24-bit pointers in early m68k chips was just saving 8 bits worth of address lines.
The SPARC had tag support in hardware, in the form of special arithmetic opcodes. Further explanation:
http://compilers.iecc.com/comparch/article/91-04-088
> I'm not sure if allowing tagging was intentional when Motorola designed the 68k
Definitely not; it was a cost-saving measure, and a lot of software broke when a later processor made pointers fully 32-bit.
> but Mac OS did store flags in the upper bits of a pointer at some stage.
...and having a 32-bit-clean Finder was a big deal for a while because that meant it could run on the newer hardware.
Amiga Basic for example, wouldn't run on 68020 up because Microsoft used the upper 8 bits (amongst a whole slew of other horrible bugs and performance problems - it's probably the worst Microsoft product ever in terms of code quality)
http://www.gnu.org/software/guile/manual/html_node/Data-Repr...
Tagging: http://www.gnu.org/software/guile/manual/html_node/Faster-In...
Another interesting technique is NaN-tagging (used in LuaJIT): http://wingolog.org/archives/2011/05/18/value-representation...