3 ms·
Not a whole lot of language runtimes (if any) really depend on upper address ignore. AFAIK, AMD only added it in Zen4.
by monocasa 1y ago
Not a whole lot of language runtimes (if any) really depend on upper address ignore.
AFAIK, AMD only added it in Zen4.
- fooker 1y agoLua does
- pansa2 1y agoI thought one of Lua’s selling points is that it’s written in highly standard-compliant C code. I wouldn’t expect it to do anything non-portable like bitwise manipulation of pointers?
- sparkie 1y agoIt's fine to use techniques like this in standard C provided you guard them with the preprocessor and provide a fallback option on unsupported hardware.
- wahern 1y agoPUC Lua doesn't use these tricks; every value in the VM is represented with a POD struct with explicit tag and value members. The OP may have been thinking of LuaJIT, which uses NaN boxing, but not pointer tagging. PUC Lua does rely on two's complement integer representation, though, as well as long long, while nominally adhering to C90, so not quite strictly conforming.
- erichocean 1y agoThe JVM does with the ZGC garbage collector, did a really nice talk on it recently. [0] [0] https://www.youtube.com/watch?v=y_QeST7Axrw https://www.youtube.com/watch?v=y_QeST7Axrw
- monocasa 1y agoThe JVM optionally does it. It does not rely on it.
- sparkie 1y agoYou don't need the hardware UAI/LAM to make use of the high pointer bits. The most common technique is to use `shl reg, 16; sar reg, 16`, which will shift in ones or zeros from the left depending on the 47th bit. Several runtimes use high bits tagging combined with NaN-boxing, and have been doing so since before LAM/UAI existed.