D Language Foundation October 2023 Quarterly Meeting Summary

Siarhei Siamashka siarhei.siamashka at gmail.com
Sun Dec 10 17:11:04 UTC 2023


On Sunday, 10 December 2023 at 15:08:05 UTC, Bastiaan Veelo wrote:
> 1) Missing `scope` storage class specifiers on `delegate` 
> function arguments. This can be chalked down as a beginner 
> error, but also one that is easy to miss. If you didn't know: 
> without `scope` the compiler cannot be sure that the delegate 
> is not stored in some variable that has a longer lifetime than 
> the stack frame of the (nested) function pointed to by the 
> delegate. Therefore, a dynamic closure is created, which means 
> that the stack is copied to new GC-allocated memory. In the 
> majority of our cases, delegate arguments are simple callbacks 
> that are only stored on the stack, but a select number of 
> delegates in the GUI are stored for longer. The compiler can 
> check if `scope` delegates escape a function, but it only does 
> this in `@safe` code --- and our code is long from being 
> `@safe`. So it was a bit of a puzzle to find out which 
> arguments needed to be `scope` and which arguments couldn't be 
> `scope`.

This reminded me of 
https://forum.dlang.org/thread/myiqlzkghnnyykbyksga@forum.dlang.org
LDC has a special GC2Stack IR optimization pass, which is a 
lifesaver in many cases like this.

> So now all cores are finally under full load, which is a 
> magnificent sight! Speed of DMD `release-nobounds` is on par 
> with our Pascal version, if not slightly faster. We are looking 
> forward to being able to safely use LDC, because tests show 
> that it has the potential to at least double the performance.

Are there some known blocker bugs, which prevent a safe usage of 
LDC in production?


More information about the Digitalmars-d-announce mailing list