On Thu, 11 Jun 2026 18:45:06 GMT, Ashay Rane <[email protected]> wrote:

> Every time an exception object is created, the constructor calls
> `fillInStackTrace()`, which has to walk the call stack to record every
> frame.  This is expensive, and it's also unnecessary if the exception is
> never thrown.  There are a few instances in various parts of the JDK
> libraries where we create an exception in the dominator block but don't
> always throw it.  This patch fixes those cases so that if the exception
> is not going to be thrown, it is never created in the first place.
> 
> ---------
> - [x] I confirm that I make this contribution in accordance with the [OpenJDK 
> Interim AI Policy](https://openjdk.org/legal/ai).

Thanks all for taking a look and for suggesting improvements!

Alan, regarding your question, I used a crude Perl script (too big to post 
here) that essentially looks for the cases where the block that throws the 
exception is different from the block that creates the exception.  I haven't 
measured the impact of these changes or even whether the fixes are necessary; I 
saw a similar fix in a downstream fork and decided to stamp it to other 
portions of the code.  I'm seeing this as largely a lint/style issue but if it 
doesn't seem that important, I am happy to close this PR and/or address the 
LDAP/TLS problem in a separate issue/PR.

-------------

PR Comment: https://git.openjdk.org/jdk/pull/31487#issuecomment-4694470107

Reply via email to