3 ms·
> converted the immediate throw-catch into a simple goto. This is very interesting. Both GCC and clang do not do that, as they represent exceptions as abnormal
by gpderetta 4y ago
> converted the immediate throw-catch into a simple goto.
This is very interesting. Both GCC and clang do not do that, as they represent exceptions as abnormal edges out of a basic block and don't optimize further. I guess in Java exceptions are common enough that it is worth the additional effort of transforming some of these cases into normal jumps when the destination is seen, while in C++ it is more of a vicious circle of exceptions not being optimized because they are uncommon and being used sparingly because they are optimized.
It is of course possible that Java exceptions semantics are such that they might be easier to optimize (lots of observable side effects in C++ unfortunately).