RFR: 8261912: Code IfNode::fold_compares_helper more defensively

Aleksey Shipilev shade at openjdk.java.net
Wed Feb 17 16:24:52 UTC 2021


As [JDK-8261914](https://bugs.openjdk.java.net/browse/JDK-8261914) indicates, there are cases that break the internal asserts in `IfNode::fold_compares_helper`, code added by JDK-8073480 in JDK 9. Unfortunately, release builds would happily miscompile when that happens. It would be better to code `IfNode::fold_compares_helper` more defensively, so it bails when asserts are violated. This implicitly works around the bug in JDK-8261914. The goal for this limited workaround is to be trivially backportable in order to quickly unbreak 11u, 16u and 17.

The alternative is, instead of the early returns is to do:

 lo = NULL;
 hi = NULL;

...and then wait for for the method epilog to handle it. I have no preference to either style, as the blocks this patch affects already has some early returns, and `lo/hi = NULL` are also used.

Additional testing:
 - [x] Linux x86_64 fastdebug `tier1`
 - [x]  Linux x86_64 fastdebug `tier2`
 - [x] Failing JRuby reproducer from JDK-8261914, now passing in release mode with hundreds of iterations

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

Commit messages:
 - 8261912: Code IfNode::fold_compares_helper more defensively

Changes: https://git.openjdk.java.net/jdk/pull/2610/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=2610&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8261912
  Stats: 23 lines in 1 file changed: 15 ins; 4 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/2610.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/2610/head:pull/2610

PR: https://git.openjdk.java.net/jdk/pull/2610


More information about the hotspot-compiler-dev mailing list