6 ms·
It’s a nice tutorial on base plus index addressing but from the title I expected a tutorial on pointer tags as x86_64 is what makes tags even possible, i.e. we
by esmi 6y ago
It’s a nice tutorial on base plus index addressing but from the title I expected a tutorial on pointer tags as x86_64 is what makes tags even possible, i.e. we have a 64b address space but not 2^64 memory locations.
https://www.mikeash.com/pyblog/friday-qa-2012-07-27-lets-build-tagged-pointers.html https://www.mikeash.com/pyblog/friday-qa-2012-07-27-lets-bui...
And for ARM.
https://www.mikeash.com/pyblog/friday-qa-2013-09-27-arm64-and-you.html https://www.mikeash.com/pyblog/friday-qa-2013-09-27-arm64-an...
- saagarjha 6y agoActually, Objective-C's tagged pointers mostly rely on malloc's alignment guarantees.
- esmi 6y agoSure. Some software has to exist to make use of this system, for example something has to create the tag in the first place, and mall ic is a part of that, but the large address space is what makes them possible.
- dan-robertson 6y agoThis is the case for most tagged pointer systems. Indeed most of them come from a time when 32 bit support was required.
- akira2501 6y ago> i.e. we have a 64b address space but not 2^64 memory locations. Except the designers foresaw this and established Canonical Addresses[0] to prevent people from using that "unused" space for tags. The space is explicitly reserved. This is probably why LuaJIT uses NaN tagging of doubles instead of tagged pointers.. even though that causes an issue of it's own[1]. [0]: https://en.wikipedia.org/wiki/X86-64#Virtual_address_space_details https://en.wikipedia.org/wiki/X86-64#Virtual_address_space_d... [1]: https://github.com/LuaJIT/LuaJIT/issues/49 https://github.com/LuaJIT/LuaJIT/issues/49