compiler support added for precise GC

Steven Schveighoffer schveiguy at yahoo.com
Mon Apr 16 13:52:54 PDT 2012


On Sun, 15 Apr 2012 22:24:56 -0400, Walter Bright  
<newshound2 at digitalmars.com> wrote:

> Just checked it in. Of course, it doesn't actually do precise GC, it is  
> just thrown over the wall for the library devs who are itching to get  
> started on it.
>
> I added a getGCInfo() method to TypeInfo that returns an  
> immutable(void)*. This pointer can be anything - a pointer to data, to  
> code, whatever, that implements whatever the GC might need to do precise  
> collections. The value is generated by the template GCInfo(T) in  
> object.d.

I feel this actually can be more generic.  Can we change this to a more  
generic term?  For example getRTInfo (short for get runtime info) and  
RTInfo(T)?

Here is my thought:  the GC is not the only entity that might be  
interested in permanently storing compile-time info for use at runtime.   
Yes, the GC could use this (perhaps exclusively), but this actually works  
as a fairly good hook to generate RTTI necessary to do reflection.

Previously, one had to either parse the object file or make multiple  
passes through the compiler to generate the info and then include it.   
With this template solution, the compiler generates the info using the  
template and then stores it in TypeInfo.

But we need to change the name early on to avoid conflicts.  I don't think  
a more generic name would be inappropriate, even if the GC is the only  
client at first.

-Steve


More information about the Digitalmars-d mailing list