RFR(S): 8201368: IfNode::fold_compares() may lead to incorrect execution

Nils Eliasson nils.eliasson at oracle.com
Thu Apr 12 08:29:40 UTC 2018

Hi Roland,

Thanks for fixing!

Add "-Xmixed" to the test commandline to disable -Xcomp for this test. 
-XX:-BackgroundCompilation is costly in combination with -Xcomp.

Looks good otherwise,



On 2018-04-11 09:42, Roland Westrelin wrote:
> http://cr.openjdk.java.net/~roland/8201368/webrev.00/
> In the test case, test_helper() inlined into test() has 3 tests. They
> all branch to an uncommon trap. The 1st and 3rd are folded into an
> unsigned comparison. The 2nd test is then above the unsigned comparison
> but to guarantee correct execution its uncommon trap is changed so it
> resumes execution at the 1st if. That would work fine if the 1st if's
> uncommon trap would cause execution to restart before the 1st if but
> it's not the case here: the uncommon trap causes execution to resume in
> the exception handler. So, after transformation, if the 2nd if triggers
> an uncommon trap, rather than continue execution at the first if as
> expected, execution continues in the exception handler.
> The fix verifies that the uncommon trap of the 1st if is at a point that
> dominates the uncommon trap of the 2nd if.
> Roland.

More information about the hotspot-compiler-dev mailing list