C2 doesn't hoist out flattened value array guard out of loops

Sergey Kuksenko sergey.kuksenko at oracle.com
Thu Mar 28 21:37:59 UTC 2019


Please, look into that issue 
https://bugs.openjdk.java.net/browse/JDK-8221647

That issue is real showstopper for any other valhalla performance 
evaluations.

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 
herehttp://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







More information about the valhalla-dev mailing list