What is the best pointer tagging method?
coredumped.dev
coredumped.dev
is not true. Intel and AMD both have variants of TBI on their chips, called Linear Address Masking and Upper Address Ignore respectively. It's a bit of a mess, unfortunately, with both masking off different bits from the top of the address (and different bits than ARM TBI does), but it does exist.
An idea Cliff Click first employed while at Azul and has now made it back into Hotspot.
That's not the only benefit. The main benefit is arguably that you don't have to allocate floats on the heap and garbage collect them. Numerical code allocates lots of numbers, so having these all be inline rather than heap-allocated saves lots of space and time.
If you GC then it’s more pointer chasing during mark. Which will cache thrash at least one CPU, even if it’s not the one where most of the code is running.
https://en.wikipedia.org/wiki/Classic_Mac_OS_memory_manageme...
The other approach is CompressedOops, where instead of wasting pointer bits (and maybe using them for tags), Java's HotSpot VM chooses to only store a 32-bit offset for an eight-aligned heap object if the entire heap is known to fit within 2^(32+3) which is 32 GB from its base address.
https://news.ycombinator.com/item?id=22398251
And didn't somebody write about creating a large aligned arena for each type and essentially grabbing the base address of the arena as a (non-unique) type tag for its objects? Then the moving GC would use these arenas as semispaces.
If you can reduce your tag to a single bit (object vs primitive), a single byte of tag data can cover 8 variables, and a bigger integer can cover a whole 64 variables, plenty for most functions.
In a stack frame, all the local variables have their tags together.
For the fields of an object, all the tags are stored together in the object.