DIP60: @nogc attribute
Steven Schveighoffer via Digitalmars-d
digitalmars-d at puremagic.com
Tue Apr 22 10:52:27 PDT 2014
On Tue, 22 Apr 2014 13:35:20 -0400, Steven Schveighoffer
<schveiguy at yahoo.com> wrote:
> On Tue, 22 Apr 2014 13:22:19 -0400, Ola Fosheim Grøstad
> <ola.fosheim.grostad+dlang at gmail.com> wrote:
>
>> On Tuesday, 22 April 2014 at 16:58:23 UTC, Kapps wrote:
>>> iOS now on 64-bit processors doesn't necessarily use a hashtable
>>> for refcounting. Basically, only 33 bits of the 64-bit pointer
>>> are used to actually refer to an address, then 19 of the
>>> remaining bits are used to store an inline reference count.
>>
>> I am sure you are right, but how does that work? Do you have a link?
>
> I think what he's saying is the 19 bits are an offset into the global
> ref count container. Some sentinel value means "lookup the pointer in a
> hashtable."
Sorry, I was wrong. And so was Kapps, according to the article he
referenced.
The 33 bits of the 64 bit pointer are used to point at a *class*, via the
object's isa member. The other 19 bits can be used for ref counting. I
mistakenly thought he meant the pointer to the object.
This is kind of weird though. Why do it this way? If there is such an
advantage to having the ref count inside the object (and I don't disagree
with that), why didn't they do that before? Surely adding another 32-bit
field wouldn't have killed the runtime.
Even doing it the way they have seems unnecessarily complex, given that
iOS 64-bit was brand new.
-Steve
More information about the Digitalmars-d
mailing list