RFR: 8261912: Code IfNode::fold_compares_helper more defensively

Aleksey Shipilev shade at openjdk.java.net
Thu Feb 18 10:58:45 UTC 2021


On Thu, 18 Feb 2021 07:16:56 GMT, Tobias Hartmann <thartmann at openjdk.org> wrote:

>> 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
>
> Looks good.

The remaining test failure should be resolved with #2614. I'll integrate once this PR is 24 hours old.

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

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


More information about the hotspot-compiler-dev mailing list