dmd foreach loops throw exceptions on invalid UTF sequences, use replacementDchar instead

deadalnix deadalnix at gmail.com
Fri Nov 5 21:43:55 UTC 2021


On Friday, 5 November 2021 at 20:41:34 UTC, Walter Bright wrote:
> On 11/5/2021 6:25 AM, Andrei Alexandrescu wrote:
>> I've been doing a fair amount of benchmarking for 
>> https://amazon.com/Embracing-Modern-Safely-John-Lakos/dp/0137380356 and surprisingly enough the myth holds true in most cases.
>
> All the compilers I know of abandon many optimizations in the 
> presence of unwind blocks.
>
> For example, register allocation of variables is not done 
> across unwind blocks. This is because the unwinder does not 
> restore register contents.
>
> A further problem is data flow analysis becomes largely 
> ineffective because any operation that may throw (such as a 
> function call to a throwing function) produces an edge from 
> there to the catch block.

I have not checked for GCC, but modern version of LLVM are pretty 
good at optimizing in the presence of landing pads. Not so good 
at optimizing the landing pad themselves, but hey, if you get 
there often, something has gone horribly wrong and optimization 
is the least of your concerns.

While I have not checked GCC, I'm fairly confident it does a good 
job.

That being said, on windows, it's another can of worm, because 
their exception ABI is some special level of crazy.


More information about the Digitalmars-d mailing list