RFR: 8350330: C2: PhaseIdealLoop::add_parse_predicate() should mirror GraphKit::add_parse_predicate()

Christian Hagedorn chagedorn at openjdk.org
Fri Jan 23 07:40:03 UTC 2026


On Thu, 22 Jan 2026 16:22:34 GMT, Roland Westrelin <roland at openjdk.org> wrote:

> `PhaseIdealLoop::add_parse_predicate()` was intented to mirror
> `GraphKit::add_parse_predicate()` but it doesn't. That last one checks
> `too_many_traps` per bci but the `PhaseIdealLoop` version doesn't. As
> demonstrated by the test case, a method can get compiled with a
> predicate, take a trap, and get recompiled with the same predicate
> many times (up to ~100).

That looks good to me, thanks for fixing this inconsistency!

test/hotspot/jtreg/compiler/longcountedloops/TestLoopNestTooManyTraps.java line 34:

> 32:  *      -XX:-BackgroundCompilation -XX:-ShortRunningLongLoop -XX:-UseOnStackReplacement
> 33:  *      -XX:CompileOnly=*TestLoopNestTooManyTraps::test1 -XX:LoopMaxUnroll=0
> 34:  *      compiler.longcountedloops.TestLoopNestTooManyTraps

Nice test! Would it make sense for this special test to also have a non-flag run?

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

Marked as reviewed by chagedorn (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/29367#pullrequestreview-3696092503
PR Review Comment: https://git.openjdk.org/jdk/pull/29367#discussion_r2719968874


More information about the hotspot-compiler-dev mailing list