Typed GC

evansl cppljevans at suddenlink.net
Wed Feb 26 08:51:25 PST 2014


On 02/26/14 10:25, evansl wrote:
> On 02/12/14 06:11, Shammah Chancellor wrote:
>> With all the talk of garbage collection.  I was wondering if it would be
>> useful to make the GC typed.  If it was typed, it maybe be possible to
>> make it more efficient via type information, (such as only scanning
>> reference fields).   Also, it could have access to attribute information
>> if applicable.
>>
>> -S.
>>
> Hi Shammah,
>
> In an earlier thread, Andrei proposed:
>
>    I suspect that allocating and manipulating objects on the GC heap in
>    particular may have certain restrictions. One possibility to avoid
>    such restrictions is to have a function typify(T)(void* p) which
>    ascribes type T to heap location p.
>
> which would be one way to at least record the type of each memory
> location.  However, later posts in that thread indicated there
> were problems with where to store that information.  I thought
> you could store it in the heap along side the pointed to object;
> however, that seemed to have problems, according to this post:
>
> http://forum.dlang.org/thread/lao9fn$1d70$1@digitalmars.com?page=12#post-jgommvkndygzcpxxotly:40forum.dlang.org
>
>
> So, the idea seems good, but I'd guess implementation is problematic.
> At least that's what I guess from the referenced posts.
>
> -regards,
> Larry
>
OOPS.  Just read Benjamin's post:

http://forum.dlang.org/post/ldhquc$11ec$1@digitalmars.com

and then the druntime code:

https://github.com/D-Programming-Language/druntime/blob/e47a00bff935c3f079bb567a6ec97663ba384487/src/object_.d#L2629

which contains:

     immutable(void)* m_RTInfo; // data for precise GC

     override @property immutable(void)* rtInfo() const
     { return m_RTInfo; }

So, I guess m_RTInfo contains information from which the pointers
within the object can be precisely found.

Sorry for noise :(

-Larry



More information about the Digitalmars-d mailing list