RFR: 8373420: C2: Add true/false_proj*() methods for IfNode as a replacement for proj_out*(true/false)

Christian Hagedorn chagedorn at openjdk.org
Wed Dec 10 13:25:39 UTC 2025


There are a lot of places in the code where we call `proj_out*(true/false)` on an `IfNode`. In some cases, we then cast the returned `ProjNode` back to `IfProjNode` or `IfTrueNode/IfFalseNode`. I often visit such code and now decided to clean this up.

The patch proposes new `IfNode::true/false_proj*()` methods that return `IfTrueNode/IfFalseNode` directly. I walked through all `proj_out*()` calls and replaced those that used a direct `true/false` or `1/0` as argument.

There are still more things to clean up in this area, for example, when we return `ProjNode` even though it should be an `IfProjNode` which requires more casting. But let's do that step by step in follow-up clean ups.

Thanks,
Christian

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

Commit messages:
 - Fix after merge
 - Merge branch 'master' into JDK-8373420
 - 8373420: C2: Add true/false_proj*() methods for IfNode as a replacement for proj_out*(true/false)

Changes: https://git.openjdk.org/jdk/pull/28745/files
  Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=28745&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8373420
  Stats: 66 lines in 11 files changed: 20 ins; 4 del; 42 mod
  Patch: https://git.openjdk.org/jdk/pull/28745.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/28745/head:pull/28745

PR: https://git.openjdk.org/jdk/pull/28745


More information about the hotspot-compiler-dev mailing list