Traversing an array of value types seen as an array of Object is slow

forax at univ-mlv.fr forax at univ-mlv.fr
Thu Jun 28 09:22:07 UTC 2018



----- Mail original -----
> De: "Roland Westrelin" <rwestrel at redhat.com>
> À: "Remi Forax" <forax at univ-mlv.fr>, "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Jeudi 28 Juin 2018 10:15:34
> Objet: Re: Traversing an array of value types seen as an array of Object is slow

>> It seems that the JIT never try to optimize the loop for whatever
>> reason so the loop is done by the interpreter and only the access to
>> the array cell is JITed.
> 
> We currently don't support loading from an Object[] array that's
> actually a flattened value type array because we can't tell at compile
> time what value type is being loaded. That forces compiled code to
> deoptimize.

You can have a generic assembly code that loads the flattened value type as a reference (you need this kind of code for java.lang.reflect.Array.get() too) or/and
you can consider that accessing the array is like a method call and profile the value type array and deoptimize only once. In that case, the profile should be the size of the layout of the value type.

> 
> Roland.

Rémi



More information about the valhalla-dev mailing list