author | kvn |
Tue, 04 Jun 2019 12:44:53 -0700 | |
changeset 55206 | 2fe2063fe567 |
parent 54669 | ad45b3802d4e |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
47216
diff
changeset
|
2 |
* Copyright (c) 2015, 2019, Oracle and/or its affiliates. All rights reserved. |
33160 | 3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 |
* |
|
5 |
* This code is free software; you can redistribute it and/or modify it |
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
|
7 |
* published by the Free Software Foundation. |
|
8 |
* |
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
|
13 |
* accompanied this code). |
|
14 |
* |
|
15 |
* You should have received a copy of the GNU General Public License version |
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
|
18 |
* |
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
|
20 |
* or visit www.oracle.com if you need additional information or have any |
|
21 |
* questions. |
|
22 |
*/ |
|
23 |
||
24 |
/* |
|
25 |
* @test |
|
26 |
* @bug 8136421 |
|
42607
acd91f1875d4
8170227: use vm.jvmci property in compiler/jvmci tests
iignatyev
parents:
41705
diff
changeset
|
27 |
* @requires vm.jvmci |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40372
diff
changeset
|
28 |
* @library /test/lib / |
36508 | 29 |
* @library ../common/patches |
54669
ad45b3802d4e
8220623: [JVMCI] Update JVMCI to support JVMCI based Compiler compiled into shared library
kvn
parents:
47216
diff
changeset
|
30 |
* @ignore Not supported JVMCI API |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36508
diff
changeset
|
31 |
* @modules java.base/jdk.internal.misc |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
32 |
* @modules java.base/jdk.internal.org.objectweb.asm |
43972 | 33 |
* java.base/jdk.internal.org.objectweb.asm.tree |
34 |
* jdk.internal.vm.ci/jdk.vm.ci.hotspot |
|
35 |
* jdk.internal.vm.ci/jdk.vm.ci.meta |
|
36 |
* jdk.internal.vm.ci/jdk.vm.ci.code |
|
40053
b3617982544e
8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents:
39291
diff
changeset
|
37 |
* |
43972 | 38 |
* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper |
36508 | 39 |
* @run main/othervm -Xbootclasspath/a:. |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
40 |
* -XX:+UnlockDiagnosticVMOptions |
36508 | 41 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI |
55206 | 42 |
* -XX:-UseJVMCICompiler |
36508 | 43 |
* compiler.jvmci.compilerToVM.GetConstantPoolTest |
33160 | 44 |
*/ |
45 |
package compiler.jvmci.compilerToVM; |
|
46 |
||
40059 | 47 |
import jdk.test.lib.Utils; |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
48 |
import compiler.jvmci.common.CTVMUtilities; |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
49 |
import compiler.jvmci.common.testcases.TestCase; |
33160 | 50 |
import jdk.vm.ci.hotspot.CompilerToVMHelper; |
33632 | 51 |
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
52 |
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; |
40059 | 53 |
import jdk.vm.ci.meta.ConstantPool; |
54 |
||
55 |
import java.lang.reflect.Field; |
|
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
56 |
import java.lang.reflect.Executable; |
33160 | 57 |
|
58 |
/** |
|
59 |
* Tests for jdk.vm.ci.hotspot.CompilerToVM::getConstantPool method |
|
60 |
*/ |
|
61 |
public class GetConstantPoolTest { |
|
62 |
||
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
63 |
public static void testMethod(Executable executable) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
64 |
test(CTVMUtilities.getResolvedMethod(executable)); |
33160 | 65 |
} |
66 |
||
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
67 |
public static void testClass(Class cls) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
68 |
HotSpotResolvedObjectType type = CompilerToVMHelper |
46972
3e88de95fccf
8186459: [JVMCI] ClassNotFoundException thrown by CompilerToVM.lookupType() should be converted to a LinkageError
dnsimon
parents:
44836
diff
changeset
|
69 |
.lookupTypeHelper(Utils.toJVMTypeSignature(cls), |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
70 |
GetConstantPoolTest.class, /* resolve = */ true); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
71 |
test(type); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
72 |
} |
33160 | 73 |
|
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
74 |
private static void test(Object object) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
75 |
ConstantPool cp = CompilerToVMHelper.getConstantPool(object); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
76 |
System.out.println(object + " -> " + cp); |
33160 | 77 |
} |
78 |
||
79 |
public static void main(String[] args) { |
|
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
80 |
TestCase.getAllClasses().forEach(GetConstantPoolTest::testClass); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
81 |
TestCase.getAllExecutables().forEach(GetConstantPoolTest::testMethod); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
82 |
testNull(); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
83 |
testObject(); |
33160 | 84 |
} |
85 |
||
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
86 |
private static void testNull() { |
33160 | 87 |
try { |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
88 |
Object cp = CompilerToVMHelper.getConstantPool(null); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
89 |
throw new AssertionError("Test OBJECT." |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
90 |
+ " Expected IllegalArgumentException has not been caught"); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
91 |
} catch (NullPointerException npe) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
92 |
// expected |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
93 |
} |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
94 |
} |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
95 |
private static void testObject() { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
96 |
try { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
97 |
Object cp = CompilerToVMHelper.getConstantPool(new Object()); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
98 |
throw new AssertionError("Test OBJECT." |
33160 | 99 |
+ " Expected IllegalArgumentException has not been caught"); |
100 |
} catch (IllegalArgumentException iae) { |
|
101 |
// expected |
|
102 |
} |
|
103 |
} |
|
104 |
} |