[Dlang-internal] Enabling GC in the compiler library

safety0ff via Dlang-internal dlang-internal at puremagic.com
Mon Jun 26 14:38:07 PDT 2017


On Monday, 26 June 2017 at 11:32:30 UTC, RazvanN wrote:
>
> I was wondering what would it be necessary to make the
> compiler GCable.

If my memory serve me correctly:
You need to verify that all allocations are either GC managed or 
registered via the addRoot/addRange API.
Some allocations bypass the current wrapper for switching between 
GC allocation and normal allocation.
To catch these you can switch dmd to use GC and wrap malloc / 
global operator::new  display a stack trace so you can review the 
code for GC compatibility.

IIRC, allocation operator::new was the key to making it work.

>
> Last time I tried to build dmd with GC, I couldn't compile
> druntime or phobos, so I wanted to know what was the first
> feature that needed GC.disable()?

AFAIK it's all in the name of performance



More information about the Dlang-internal mailing list