author | iignatyev |
Mon, 18 Feb 2019 09:31:07 -0800 | |
changeset 53791 | bec6c8739833 |
parent 47216 | 71c04702a3d5 |
child 54669 | ad45b3802d4e |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40372
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, 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 |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36508
diff
changeset
|
30 |
* @modules java.base/jdk.internal.misc |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
31 |
* @modules java.base/jdk.internal.org.objectweb.asm |
43972 | 32 |
* java.base/jdk.internal.org.objectweb.asm.tree |
33 |
* jdk.internal.vm.ci/jdk.vm.ci.hotspot |
|
34 |
* jdk.internal.vm.ci/jdk.vm.ci.meta |
|
35 |
* 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
|
36 |
* |
43972 | 37 |
* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper |
36508 | 38 |
* @run main/othervm -Xbootclasspath/a:. |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
39 |
* -XX:+UnlockDiagnosticVMOptions |
36508 | 40 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI |
44836 | 41 |
* -Djvmci.Compiler=null |
36508 | 42 |
* compiler.jvmci.compilerToVM.GetConstantPoolTest |
33160 | 43 |
*/ |
44 |
package compiler.jvmci.compilerToVM; |
|
45 |
||
40059 | 46 |
import jdk.test.lib.Utils; |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
47 |
import compiler.jvmci.common.CTVMUtilities; |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
48 |
import compiler.jvmci.common.testcases.TestCase; |
33160 | 49 |
import jdk.vm.ci.hotspot.CompilerToVMHelper; |
33632 | 50 |
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
51 |
import jdk.vm.ci.hotspot.HotSpotResolvedObjectType; |
40059 | 52 |
import jdk.vm.ci.meta.ConstantPool; |
53 |
||
54 |
import java.lang.reflect.Field; |
|
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
55 |
import java.lang.reflect.Executable; |
33160 | 56 |
|
57 |
/** |
|
58 |
* Tests for jdk.vm.ci.hotspot.CompilerToVM::getConstantPool method |
|
59 |
*/ |
|
60 |
public class GetConstantPoolTest { |
|
61 |
||
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
62 |
public static void testMethod(Executable executable) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
63 |
test(CTVMUtilities.getResolvedMethod(executable)); |
33160 | 64 |
} |
65 |
||
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
66 |
public static void testClass(Class cls) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
67 |
HotSpotResolvedObjectType type = CompilerToVMHelper |
46972
3e88de95fccf
8186459: [JVMCI] ClassNotFoundException thrown by CompilerToVM.lookupType() should be converted to a LinkageError
dnsimon
parents:
44836
diff
changeset
|
68 |
.lookupTypeHelper(Utils.toJVMTypeSignature(cls), |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
69 |
GetConstantPoolTest.class, /* resolve = */ true); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
70 |
test(type); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
71 |
} |
33160 | 72 |
|
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
73 |
private static void test(Object object) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
74 |
ConstantPool cp = CompilerToVMHelper.getConstantPool(object); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
75 |
System.out.println(object + " -> " + cp); |
33160 | 76 |
} |
77 |
||
78 |
public static void main(String[] args) { |
|
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
79 |
TestCase.getAllClasses().forEach(GetConstantPoolTest::testClass); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
80 |
TestCase.getAllExecutables().forEach(GetConstantPoolTest::testMethod); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
81 |
testNull(); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
82 |
testObject(); |
33160 | 83 |
} |
84 |
||
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
85 |
private static void testNull() { |
33160 | 86 |
try { |
40372
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
87 |
Object cp = CompilerToVMHelper.getConstantPool(null); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
88 |
throw new AssertionError("Test OBJECT." |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
89 |
+ " Expected IllegalArgumentException has not been caught"); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
90 |
} catch (NullPointerException npe) { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
91 |
// expected |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
92 |
} |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
93 |
} |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
94 |
private static void testObject() { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
95 |
try { |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
96 |
Object cp = CompilerToVMHelper.getConstantPool(new Object()); |
ee472073dab0
8163105: SIGSEGV: constantPoolHandle::constantPoolHandle(ConstantPool*)
dnsimon
parents:
40059
diff
changeset
|
97 |
throw new AssertionError("Test OBJECT." |
33160 | 98 |
+ " Expected IllegalArgumentException has not been caught"); |
99 |
} catch (IllegalArgumentException iae) { |
|
100 |
// expected |
|
101 |
} |
|
102 |
} |
|
103 |
} |