Componentizing D's garbage collector

Benjamin Thaut code at benjamin-thaut.de
Tue Jan 14 10:29:31 PST 2014


Am 14.01.2014 19:26, schrieb Timon Gehr:
> On 01/14/2014 06:56 PM, Benjamin Thaut wrote:
>> Am 14.01.2014 14:42, schrieb Timon Gehr:
>>> On 01/14/2014 10:20 AM, Benjamin Thaut wrote:
>>>> Am 14.01.2014 09:15, schrieb Jacob Carlborg:
>>>>> On 2014-01-13 22:23, Timon Gehr wrote:
>>>>>
>>>>>> Yes, there is a cost. The requirement to pin arbitrary objects at
>>>>>> arbitrary times, without the possibility to move at pinning time,
>>>>>> invalidates GC algorithms that depend on being able to move _all_
>>>>>> objects within some pool.
>>>>>
>>>>> Can't these object be pinned somewhere else?
>>>>>
>>>>
>>>> Yes, thats the usual approach. But that means that you have to copy
>>>> them
>>>> to a other space before pinning, or allocate them in a space that
>>>> allows
>>>> pinning in the first place.
>>>
>>> Once it becomes known that an object should be pinned, it is too late
>>> for moving. (There will then exist a potential pointer to the object.)
>>
>> Well no, usually you have to pin objects _before_ passing them to
>> C-land. Pinning is not a automatic process its done manually (or by the
>> compiler).
>
> Well, there is no such manual mechanism in place, so only strategies
> implemented fully within the compiler work.
>
> I think it is not very sensible to let the compiler insert call-backs to
> eg. pin objects pointed to from unions. It might as well track occupied
> pointer fields explicitly then.
>
> In any case, I think we should just require manual marking of unions and
> call it a day.

Yes, but pinning will still be necessary for passing data to C/C++ 
functions.


More information about the Digitalmars-d mailing list