[15] RFR (S): 8247502: PhaseStringOpts crashes while optimising effectively dead code

Vladimir Ivanov vladimir.x.ivanov at oracle.com
Fri Jul 10 16:26:33 UTC 2020


https://bugs.openjdk.java.net/browse/JDK-8247502
http://cr.openjdk.java.net/~vlivanov/8247502/webrev.00/

As Tobias discovered, PhaseStringOpts crashes when it encounters 
String::append() argument being TOP: TOP is a constant, but the code 
expects to see a String constant instead.

It happens while processing a call in unreachable infinite loop. The 
code is effectively dead, but IGVN and PhaseRemoveUseless don't see 
that. It is discovered later when loop opts kick in which clean it up.

Proposed fix tries to make the code more robust and just bails out the 
optimization when TOP is encountered.

Alternative way to fix the problem would be to clean up the graph before 
PhaseStringOpts (e.g., by running PhaseIdealLoop(LoopOptsNone) since 
PhaseRemoveUseless is not enough), but PhaseIdealLoop pass can be 
expensive. So, I'm in favor of the local fix in PhaseStringOpts.

Testing: crash reproducer, hs-precheckin-comp, hs-tier1, hs-tier2, tier1

Thanks!

PS: no regression test since I wasn't able to extract a simple 
reproducer from the crash log.

Best regards,
Vladimir Ivanov


More information about the hotspot-compiler-dev mailing list