author | chegar |
Thu, 17 Oct 2019 20:54:25 +0100 | |
branch | datagramsocketimpl-branch |
changeset 58679 | 9c3209ff7550 |
parent 58678 | 9cf78a70fa4f |
parent 55487 | 79c32c7b0992 |
permissions | -rw-r--r-- |
36306
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
1 |
/* |
55206 | 2 |
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. |
36306
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
4 |
* |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
8 |
* |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
13 |
* accompanied this code). |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
14 |
* |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
18 |
* |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
21 |
* questions. |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
22 |
*/ |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
23 |
|
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
24 |
/* |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
25 |
* @test |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
26 |
* @bug 8138708 |
55487
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
27 |
* @bug 8136421 |
42607
acd91f1875d4
8170227: use vm.jvmci property in compiler/jvmci tests
iignatyev
parents:
41705
diff
changeset
|
28 |
* @requires vm.jvmci |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40059
diff
changeset
|
29 |
* @library /test/lib / |
36508 | 30 |
* @library ../common/patches |
52427
3c6aa484536c
8211122: Reduce the number of internal classes made accessible to jdk.unsupported
mchung
parents:
47216
diff
changeset
|
31 |
* @modules java.base/jdk.internal.access |
37301
a936b4e01afb
8137058: Clear out all non-Critical APIs from sun.reflect
chegar
parents:
36508
diff
changeset
|
32 |
* java.base/jdk.internal.reflect |
36508 | 33 |
* java.base/jdk.internal.org.objectweb.asm |
34 |
* java.base/jdk.internal.org.objectweb.asm.tree |
|
43972 | 35 |
* jdk.internal.vm.ci/jdk.vm.ci.hotspot |
36 |
* jdk.internal.vm.ci/jdk.vm.ci.runtime |
|
37 |
* jdk.internal.vm.ci/jdk.vm.ci.meta |
|
40053
b3617982544e
8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents:
39450
diff
changeset
|
38 |
* |
43972 | 39 |
* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox |
40053
b3617982544e
8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents:
39450
diff
changeset
|
40 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
b3617982544e
8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents:
39450
diff
changeset
|
41 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
36306
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
42 |
* @run main/othervm -Xbootclasspath/a:. -XX:+UnlockDiagnosticVMOptions |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
43 |
* -XX:+WhiteBoxAPI -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI |
55206 | 44 |
* -XX:-UseJVMCICompiler |
36306
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
45 |
* compiler.jvmci.compilerToVM.ResolvePossiblyCachedConstantInPoolTest |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
46 |
*/ |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
47 |
|
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
48 |
package compiler.jvmci.compilerToVM; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
49 |
|
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
50 |
import compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
51 |
import compiler.jvmci.compilerToVM.ConstantPoolTestCase.TestedCPEntry; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
52 |
import compiler.jvmci.compilerToVM.ConstantPoolTestCase.Validator; |
40059 | 53 |
import compiler.jvmci.compilerToVM.ConstantPoolTestsHelper.DummyClasses; |
36306
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
54 |
import jdk.test.lib.Asserts; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
55 |
import jdk.vm.ci.hotspot.CompilerToVMHelper; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
56 |
import jdk.vm.ci.meta.ConstantPool; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
57 |
|
55487
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
58 |
import java.lang.invoke.MethodHandle; |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
59 |
import java.lang.invoke.MethodType; |
40059 | 60 |
import java.util.HashMap; |
61 |
import java.util.Map; |
|
62 |
||
55487
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
63 |
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODHANDLE; |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
64 |
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_METHODTYPE; |
40059 | 65 |
import static compiler.jvmci.compilerToVM.ConstantPoolTestCase.ConstantTypes.CONSTANT_STRING; |
66 |
||
36306
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
67 |
/** |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
68 |
* Test for {@code jdk.vm.ci.hotspot.CompilerToVM.resolvePossiblyCachedConstantInPool} method |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
69 |
*/ |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
70 |
public class ResolvePossiblyCachedConstantInPoolTest { |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
71 |
|
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
72 |
public static void main(String[] args) throws Exception { |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
73 |
Map<ConstantTypes, Validator> typeTests = new HashMap<>(); |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
74 |
typeTests.put(CONSTANT_STRING, ResolvePossiblyCachedConstantInPoolTest::validateString); |
55487
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
75 |
typeTests.put(CONSTANT_METHODHANDLE, ResolvePossiblyCachedConstantInPoolTest::validateMethodHandle); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
76 |
typeTests.put(CONSTANT_METHODTYPE, ResolvePossiblyCachedConstantInPoolTest::validateMethodType); |
36306
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
77 |
ConstantPoolTestCase testCase = new ConstantPoolTestCase(typeTests); |
55487
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
78 |
testCase.test(); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
79 |
// The next "Class.forName" and repeating "testCase.test()" |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
80 |
// are here for the following reason. |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
81 |
// The first test run is without dummy class initialization, |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
82 |
// which means no constant pool cache exists. |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
83 |
// The second run is with initialized class (with constant pool cache available). |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
84 |
// Some CompilerToVM methods require different input |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
85 |
// depending on whether CP cache exists or not. |
36306
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
86 |
for (DummyClasses dummy : DummyClasses.values()) { |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
87 |
Class.forName(dummy.klass.getName()); |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
88 |
} |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
89 |
testCase.test(); |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
90 |
} |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
91 |
|
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
92 |
private static void validateString(ConstantPool constantPoolCTVM, |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
93 |
ConstantTypes cpType, |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
94 |
DummyClasses dummyClass, |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
95 |
int cpi) { |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
96 |
TestedCPEntry entry = cpType.getTestedCPEntry(dummyClass, cpi); |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
97 |
if (entry == null) { |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
98 |
return; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
99 |
} |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
100 |
int index = cpi; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
101 |
String cached = ""; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
102 |
int cpci = dummyClass.getCPCacheIndex(cpi); |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
103 |
if (cpci != ConstantPoolTestsHelper.NO_CP_CACHE_PRESENT) { |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
104 |
index = cpci; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
105 |
cached = "cached "; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
106 |
} |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
107 |
Object constantInPool = CompilerToVMHelper.resolvePossiblyCachedConstantInPool(constantPoolCTVM, index); |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
108 |
String stringToVerify = (String) constantInPool; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
109 |
String stringToRefer = entry.name; |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
110 |
if (stringToRefer.equals("") && cpci != ConstantPoolTestsHelper.NO_CP_CACHE_PRESENT) { |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
111 |
stringToRefer = null; // tested method returns null for cached empty strings |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
112 |
} |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
113 |
String msg = String.format("Wrong string accessed by %sconstant pool index %d", cached, index); |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
114 |
Asserts.assertEQ(stringToRefer, stringToVerify, msg); |
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
115 |
} |
55487
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
116 |
|
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
117 |
private static final String NOT_NULL_MSG |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
118 |
= "Object returned by resolvePossiblyCachedConstantInPool method should not be null"; |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
119 |
|
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
120 |
|
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
121 |
private static void validateMethodHandle(ConstantPool constantPoolCTVM, |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
122 |
ConstantTypes cpType, |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
123 |
DummyClasses dummyClass, |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
124 |
int index) { |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
125 |
Object constantInPool = CompilerToVMHelper.resolvePossiblyCachedConstantInPool(constantPoolCTVM, index); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
126 |
String msg = String.format("%s for index %d", NOT_NULL_MSG, index); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
127 |
Asserts.assertNotNull(constantInPool, msg); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
128 |
if (!(constantInPool instanceof MethodHandle)) { |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
129 |
msg = String.format("Wrong constant pool entry accessed by index" |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
130 |
+ " %d: %s, but should be subclass of %s", |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
131 |
index, |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
132 |
constantInPool.getClass(), |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
133 |
MethodHandle.class.getName()); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
134 |
throw new AssertionError(msg); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
135 |
} |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
136 |
} |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
137 |
|
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
138 |
private static void validateMethodType(ConstantPool constantPoolCTVM, |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
139 |
ConstantTypes cpType, |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
140 |
DummyClasses dummyClass, |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
141 |
int index) { |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
142 |
Object constantInPool = CompilerToVMHelper.resolvePossiblyCachedConstantInPool(constantPoolCTVM, index); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
143 |
String msg = String.format("%s for index %d", NOT_NULL_MSG, index); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
144 |
Asserts.assertNotNull(constantInPool, msg); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
145 |
Class mtToVerify = constantInPool.getClass(); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
146 |
Class mtToRefer = MethodType.class; |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
147 |
msg = String.format("Wrong method type class accessed by" |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
148 |
+ " constant pool index %d", |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
149 |
index); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
150 |
Asserts.assertEQ(mtToRefer, mtToVerify, msg); |
79c32c7b0992
8225369: [AOT] vm/classfmt/cpl/cplres001/cplres00101m004/cplres00101m004.html fails
dlong
parents:
55206
diff
changeset
|
151 |
} |
36306
9b8ba80e9327
8141619: Develop new tests for JVMCI compilerToVM class' CP related methods
kshefov
parents:
diff
changeset
|
152 |
} |