Idea #1 on integrating RC with GC

Manu turkeyman at gmail.com
Wed Feb 5 07:52:36 PST 2014


On 6 February 2014 01:22, Michel Fortin <michel.fortin at michelf.ca> wrote:

> On 2014-02-05 15:01:04 +0000, Manu <turkeyman at gmail.com> said:
>
>  Aligned data is a challenge. I have often wondered if it would be feasible
>> to access the RC via a pointer hash or something, and keep it in a side
>> table... sounds tricky, but I wonder if it's possible.
>>
>
> That's what Apple is doing (as seen in the CoreFoundation source code).
> They actually have eight such tables on OS X, each protected by a spin
> lock. The right table is chosen according to a few bits of the pointer.
>
> The obvious advantage is you can put immutable data in read-only memory
> without making the reference count immutable. The downside is that it's
> more complicated to access the counter.


Indeed. Good to know someone else is doing it. Sounds like a realistic
option then :)


 Fat pointers might be necessary. That's a bit annoying. Hmmm...
>>
>
> Since we're talking about adding reference counts to GC-allocated memory,
> you could use the GC to find the base address of the memory block. What is
> the cost of that?


Can you elaborate? How would the GC know this?


 I'm sure there's a clever solution out there which would allow the ARC to
>> detect if it's a raw C pointer or not...
>>
>
> Ask the GC for the base address of the memory block. If it does not come
> from a GC block, there's no reference counter to update.
>
>
> --
> Michel Fortin
> michel.fortin at michelf.ca
> http://michelf.ca
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20140206/25223d5c/attachment.html>


More information about the Digitalmars-d mailing list