hotspot/test/compiler/jsr292/TestArrayReturnType.java
author jcm
Thu, 29 Sep 2016 22:37:05 -0700
changeset 41698 a3f113541801
permissions -rw-r--r--
8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata Summary: Always obtain return type from declared_signature for Invoke::declared_type. TypeCast return value to declared_signature return type for inlined lforms. Reviewed-by: kvn, vlivanov
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
41698
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
     1
/*
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
     2
 * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
     4
 *
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
     7
 * published by the Free Software Foundation.
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
     8
 *
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    13
 * accompanied this code).
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    14
 *
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    18
 *
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    21
 * questions.
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    22
 */
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    23
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    24
/*
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    25
 * @test
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    26
 * @bug 8134389
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    27
 *
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    28
 * @run main/othervm -Xbatch compiler.jsr292.TestArrayReturnType
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    29
 * @run main/othervm -Xbatch -XX:-Inline compiler.jsr292.TestArrayReturnType
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    30
 * @run main/othervm -Xbatch
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    31
 *      -XX:CompileCommand=exclude,compiler.jsr292.TestArrayReturnType::testArrayReturnType
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    32
 *      compiler.jsr292.TestArrayReturnType
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    33
 */
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    34
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    35
package compiler.jsr292;
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    36
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    37
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    38
import java.lang.invoke.MethodHandle;
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    39
import java.lang.invoke.MethodHandles;
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    40
import java.lang.invoke.MethodType;
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    41
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    42
public class TestArrayReturnType {
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    43
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    44
    static final MethodHandle mh;
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    45
    static int[] testArray = new int[1];
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    46
    static {
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    47
        try {
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    48
            mh = MethodHandles.lookup().findStatic(TestArrayReturnType.class, "testArrayReturnType", MethodType.methodType(int[].class));
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    49
        } catch (Exception e) {
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    50
            throw new Error(e);
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    51
        }
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    52
    }
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    53
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    54
    static int[] testArrayReturnType() {
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    55
        return testArray;
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    56
    }
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    57
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    58
    public static void test()  throws Throwable {
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    59
        int a[] = (int[])mh.invokeExact();
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    60
        for (int i=0; i<a.length; i++) {
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    61
            a[i] = 1;
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    62
        }
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    63
    }
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    64
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    65
    public static void main(String[] args) throws Throwable {
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    66
        for (int i=0; i<15000; i++) {
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    67
            test();
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    68
        }
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    69
        System.out.println("TEST PASSED");
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    70
    }
a3f113541801 8134389: Crash in HotSpot with jvm.dll+0x42b48 ciObjectFactory::create_new_metadata
jcm
parents:
diff changeset
    71
}