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
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
- relates to
-
JDK-8231615 [lworld] TestLWorld::test84/test87/test88 fail with TieredCompilation
- Resolved
-
JDK-8271280 [lworld] Revisit memory barrier requirements around inline type allocations
- Open
-
JDK-8226733 [lworld] Oop map of C2 compiled method contains narrow klass ptr
- Resolved
-
JDK-8233076 [lworld] C2 compilation fails in PhaseCFG::insert_anti_dependences
- Resolved