RFR(M): arraycopy/clone/copyOf intrinsics fixes for Lworld

Tobias Hartmann tobias.hartmann at oracle.com
Thu May 31 08:42:37 UTC 2018

Hi Roland,

this looks good!

On 30.05.2018 13:06, Roland Westrelin wrote:
> The trickiest part is that when executing copyOf for an
> array of unknown type, we go to the slow path if the array is a non
> flattened array of value types so that it's properly initialized with
> default values. The alloc site for such an array is marked ar parse time
> with a new flag.

Just wondering, is it possible that only after parsing we figure out that the exact type of the
allocation is not a value type (or a flattened value type)?

For example, with reflection and incremental inlining of 'test':

  public static <T> T[] make(Class<T> c) {
    T[] array = (T[])Array.newInstance(c, 42);
    return Arrays.copyOf(array, 10);

  public static void test() {
    Integer[] array = make(Integer.class);
    // Use array

In this case we could remove the is_unknown_value marking.


More information about the valhalla-dev mailing list