3 ms·
One huge benefit of keeping boxed objects on odd values on the low bits is that you can implement addition/subtraction of the integers without removing the flag
by whizzter 2y ago
One huge benefit of keeping boxed objects on odd values on the low bits is that you can implement addition/subtraction of the integers without removing the flag bit, doing the operation and then re-adding it, instead you can just add 2 values with the regular add instruction and then use it (since the lowest bit won't change). On the other hand having the pointer offset doesn't do much of a difference since heap values will often be accessed with an offset (and offset-load/store instructions are more or less for free in most cases so subtracting a one to an offset doesn't change the cost)