RFR(XS): 8211451: ~2.5% regression on compression benchmark starting with 12-b11

Roland Westrelin rwestrel at redhat.com
Tue Oct 16 15:44:22 UTC 2018


Hi Vladimir,

Thanks for looking at this.

> I am not sure it is correct. You can go into infinite loop with
> overflow with stride (> 1) which jump over the value you compare with.

For equality checks, stride = 1 (or -1).

  if (bt == BoolTest::eq || // Bail out, but this loop trips at most twice!
      // Odd stride
      (bt == BoolTest::ne && stride_con != 1 && stride_con != -1) ||
      // Count down loop rolls through MAXINT
      ((bt == BoolTest::le || bt == BoolTest::lt) && stride_con < 0) ||
      // Count up loop rolls through MININT
      ((bt == BoolTest::ge || bt == BoolTest::gt) && stride_con > 0)) {
    return false; // Bail out
  }

This is turning:

for (;;) {
  if (i == limit) {
    break;
  }
  i += stride;
}

into:

for (;;) {
  i += stride;
  if (i == limit+stride) {
    break;
  }
}

The test for equality is turned into an inequality check only if init <
limit is known and stride == 1 (or a similar condition for stride =
-1). In that case i += stride can't overflow. 

If the equality check is kept, i+stride can overflow only if init >
limit and that would be an infinite loop anyway.

Roland.



More information about the hotspot-compiler-dev mailing list