Re:X32 ABI
by hdevalence on Wednesday October 09, 2013 @10:28PM
(#6525336)
On the other hand, it's not like the bits of the pointer which are not used for addressing memory are necessarily wasted.
You can use them as tagged pointers [1], and I think that Apple's Obj-C runtime actually does this. (I don't know for sure, as it's not really something I'm interested in, but I think I saw an article about it. I could be wrong.)
Yes, those bits are put to very good use! In ARM64, some bits are actually used to store the reference count for the object, making -retain/-release calls super fast.
Any details on that posted somewhere?
The wackiest thing about that is... if there are multiple pointers to an object (kind of the point of reference counting) and the reference count is part of the pointer... well... I don't really see that working well at all. OTOH I could see there being some optimization that means some callers might not need to modify the global reference count, only the one in their reference.
If I'm not mistaken, those extra bits are pulled from the "isa" pointer, present in all objects and similar to a C++ vtable pointer. That is, they're in the object itself, not the pointers to it.
Mike Ash wrote an excellent summary:
http://www.mikeash.com/pyblog/friday-qa-2013-09-27-arm64-and...
OK that makes a lot more sense. Thanks.
[1] http://www.mikeash.com/pyblog/friday-qa-2013-09-27-arm64-and...