Would be great to hear some actionable details.
Would be great to hear some actionable details.
Note also that this is the intersection of bits that are available on both ARM and x86. If you want it to be portable, you need both architectures. Just because ARM64 doesn’t use a bit doesn’t mean that x86 doesn’t and vice versa.
Both x86 and ARM have proposed standards for pointer tagging in the high bits. However, those bits don’t perfectly overlap. Also, some platforms don’t fully conform to this reservation of high bits for pointer tagging, so there is a backward compatibility issue.
Across all of that, I found six high bits that were guaranteed to be safe for all current and future platforms. In practice you can probably use more but there is a portability risk.
Your mask/tag doesn't need to use the same bits on x86 and ARM to be portable, though.
My perspective is biased by the requirements of high-assurance systems.
Kinda weird to materialize pointers across architectures rather than indices.
But in any case surely the relevant consideration is “fewest number of free pointer bits on any single platform”. And not “intersection of free bits across all platforms”. Right?
Otherwise they're right, it's not the intersection that matters but just the total bits available
You can’t cram 8 bits of tag in 7 bits if the latter is all the architecture has available. Hence why you have to design for the smallest reliable target.
IIRC, the 6 high bits I mentioned was the intersection of every tag reservation implementation and/or proposal. In other words, it was the set of bits that Intel, AMD, and ARM agreed would be safe for tagging for the foreseeable future.
Fewer bits than I would like and can probably exploit, but nonetheless the number I can reasonably rely on. If a consistent standard is ever agreed upon, the number of bits may increase.
The original article already contains a note that "Some more recent x64 CPUs use 5-level paging, which would increase this number to 57 bits [0]"
Apparently server-level "Sunny Cove" Intel CPUs implement this extension [1].
[0]: https://en.wikipedia.org/wiki/Intel_5-level_paging
[1]: <https://en.wikipedia.org/wiki/Sunny_Cove_(microarchitecture)>