4 ms·
While it is nearly always true that implementing stuff in hardware doesn't help as much as software people would hope, there are interesting exceptions. The 198
by jecel 4y ago
While it is nearly always true that implementing stuff in hardware doesn't help as much as software people would hope, there are interesting exceptions. The 1986 Smalltalk processor project from Canada, called Swamp, used the top two bits of the 32 bit word as a tag. If the bits were 00 or 11 then we had a 31 bit integer (which also happen to be valid 32 bit integers for addition and subtraction, no conversion needed), while 01 was an object pointer into the heap and 10 was a reference to the stack.
Deciding if a 32 bit value is an integer or not is awkward in software, which is why Smalltalk and similar VMs use other encodings. In hardware it is a single exclusive or gate.
- dragonwriter 4y ago> Deciding if a 32 bit value is an integer or not is awkward in software, which is why Smalltalk and similar VMs use other encodings. Small integers (up to some small number of bits shorter than machine size) are stored as their value, everything else has other bits set to indicate a pointer, index into object space, or some other thing, is a very common dynamic language data representation in software VMs. XOR is cheap in softwate, too.