Precise GC

Andrei Alexandrescu SeeWebsiteForEmail at erdani.org
Tue Apr 10 06:54:54 PDT 2012


On 4/10/12 3:03 AM, deadalnix wrote:
> For every type, a function template (let's call it GCscan) will be
> instantiated to scan it. This function can be ANY code. ANY code include
> the possibility for GCscan!A to call GCscan!B directly, without going
> back to GC main loop and indirect call. If inlined, you can forget about
> function call at all (and you can force that using mixin template for
> example, but it is likely to massively generate code bloat).

That is correct. The code bloat is equal to that generated if the end 
user sat down and wrote by hand appropriate routines for collection for 
all types.

> This can't be done for reference/pointer to polymorphic types, but for
> any other it is an available option, and it can reduce dramatically the
> number of indirect calls.

Indeed. For non-final class member variables, the template will fetch 
their Typeinfo, from that the pointer to the mark function, and will 
issue the call through pointer.


Andrei


More information about the Digitalmars-d mailing list