Cleverness of GC Scanning

Steven Schveighoffer via Digitalmars-d digitalmars-d at puremagic.com
Fri Aug 7 11:29:05 PDT 2015


On 8/7/15 1:38 PM, rsw0x wrote:

> Probably a question for Martin Nowak as he seems to do a lot of the GC
> work - but I'm curious why the GC takes basically zero advantage of D's
> compile time magic(allocations are funneled through a C API,) is it
> because build times would be too slow?

Mainly legacy. The D runtime was all runtime before 'druntime' was 
included, not much compile time introspection. All the hooks to the GC 
were done via calls with the compiler passing the TypeInfo to the 
appropriate pre-defined hook.

I think we have much more tools available and greater experience these 
days, it would be nice for all compiler hooks that do any runtime calls 
(except for possibly intrinsics) to simply be rewrites to call templates 
that do the right thing.

The main barrier that I can tell is that the compiler takes liberties in 
regards to const/pure/etc. that library code cannot take.

-Steve


More information about the Digitalmars-d mailing list