RFR: 8267532: C2: Profile and prune untaken exception handlers [v5]

Vladimir Ivanov vlivanov at openjdk.org
Wed Nov 15 03:48:30 UTC 2023


On Tue, 14 Nov 2023 17:00:56 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:

> One case I can think of where a block as a whole might appear 'alive', while a call somewhere in that block appears 'dead', is when an instruction before the call always throws an exception, meaning the branch is taken, but the call never executes. Are there other cases you had in mind?

Yes, that's a legitimate case when branch profiling is not enough to catch unreachable code. I'm more concerned about other places where we may omit profiling and hence miss optimization opportunities. (Also, keep in mind that both interpreter and C1 have their own profiling implementation which can easily diverge. Not sure how to automatically filter such cases from legitimate ones though.)

In general, pruning effectively unreachable calls looks like the more in the right direction. But it looks riskier and, hence, requires more performance validation.

>> I don't fully understand the issue with has_monitor. It does look like a pre-existing issue and it's better to handle it separately.

> I don't mind moving it to a separate patch, but I don't think it's possible to trigger a failure of the current code without the changes in this patch. So, I don't think it would be possible to add a test in that case.

As of now, C2 should prune exception handlers when the corresponding exception class is unloaded. How is it different from what you implemented?

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

PR Comment: https://git.openjdk.org/jdk/pull/16416#issuecomment-1811762391
PR Comment: https://git.openjdk.org/jdk/pull/16416#issuecomment-1811763540


More information about the hotspot-dev mailing list