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

Roland Westrelin rwestrel at redhat.com
Wed Apr 11 07:42:22 UTC 2018


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