Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8221647

[lworld] Performance regression due to the fact that check if array is array of values is not hoisted out of the loop.

XMLWordPrintable

      Large performance regression is observed on numerous legacy (non-value) code working with Object[] arrays comparing -XX:+EnableValhalla vs -XX:-EnableValhalla

      For example:
      - Arrays.hasCode(Object[]) - 60% slowdown
      - for loop Object[] to Object[] copying - 2x times slowdown
      - pass elements of Object[] - 90% slowdown.
      - etc....

      Small set of simple benchmarks could be found here http://cr.openjdk.java.net/~skuksenko/valhalla/arrayloop/benchmarks/

      The reason of that that check if arrays is flattened value array was not hoisted out of the loop and checked on each iteration.

       asm for check (e.g.):
       mov 0x8(%r10),%r8d
       sar $0x1d,%r8d
       cmp $0xfffffffd,%r8d
       jne 0x00007f4d008cc2ad

            roland Roland Westrelin
            skuksenko Sergey Kuksenko
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: