C2 doesn't hoist out flattened value array guard out of loops
Tobias Hartmann
tobias.hartmann at oracle.com
Fri Mar 29 07:28:27 UTC 2019
Hi Sergey,
thanks for reporting. Is this a regression from LW1?
I'm currently working on LW2 array support for C2 which will change how we detect the array layout:
https://bugs.openjdk.java.net/browse/JDK-8220716
I'll investigate once the LW2 array changes are ready.
Best regards,
Tobias
On 28.03.19 22:37, Sergey Kuksenko wrote:
> 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