Typical security issues in C++: why the GC isn't your enemy

deadalnix deadalnix at gmail.com
Fri Dec 9 22:49:26 UTC 2022


On Friday, 9 December 2022 at 01:55:22 UTC, Walter Bright wrote:
> On 12/8/2022 4:24 PM, deadalnix wrote:
>> I do not expect this to be that expensive. It is simpler than 
>> the escape analysis that is being baked in the language right 
>> now, and roughly on par with keeping track of 
>> constructors/destructors.
>
> I've done it. It's expensive. It is not on par with ctors/dtors 
> which rely on FILO scope analysis, not data flow.
>
> D's borrow checker does do DFA, and it's slow, and one of the 
> reasons why it's active only with @live annotations. Rust uses 
> DFA, and is notoriously slow.
>
> D always initializes variables, and then the (optional) 
> optimization pass removes the unneeded ones. This is a 
> reasonable approach.

I would suggest that the way to was done probably wasn't the 
right way. Knowing how DMD works, I suspect this is done on an 
AST representation, and this is definitively hard to do it on 
such representation. This is much easier to do on an SSA or Sea 
of Node style representation.

It's fairly easy to convince oneself this is fast, any modern JIT 
does it.


More information about the Digitalmars-d mailing list