4 ms·
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 [
by hdevalence 13y ago
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.)
[1]: https://en.wikipedia.org/wiki/Tagged_pointer https://en.wikipedia.org/wiki/Tagged_pointer
- conradev 13y agoYes, 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.
- asveikau 13y agoAny 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.
- twoodfin 13y agoIf 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-you.html http://www.mikeash.com/pyblog/friday-qa-2013-09-27-arm64-and...
- asveikau 13y agoOK that makes a lot more sense. Thanks.
- deleted 13y ago[deleted]