On 05/03/2019 22:30, H. S. Teoh wrote:
> On Tue, Mar 05, 2019 at 09:50:34PM +0100, Rainer Schuetze via 
> Digitalmars-d-learn wrote:
>> On 04/03/2019 12:12, KnightMare wrote:
> [...]
>>> 3) closures: do the closures have any internal types that helps to
>>> GC or are they (full closure memory block) scanned as in the
>>> conservative mode?
>> No type information is generated for closures by the compiler, so
>> these are always scanned conservatively.
> [...]
> Just out of curiosity, how hard would it be for the compiler to emit
> type information for closures?  Given the prevalence of the range-based
> idiom in D, I'd think this is a worthwhile area for GC improvements.

I tried that first when I added debug information for closures on
Windows recently, but it didn't easily work out. I suspect it cannot be
generated early in the front-end as closures might also change due to
inlining and optimizations.

Maybe even worse than the conservative scanning: if structs are moved
into the closure, their destructors are never called, even if the
closure is collected.

Reply via email to