author | iignatyev |
Thu, 02 Aug 2018 14:40:55 -0700 | |
changeset 51287 | 7b1ddbafa134 |
parent 49358 | 0dc249f5c260 |
child 51606 | 18afb2097ada |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
51287
7b1ddbafa134
8208655: use JTreg skipped status in hotspot tests
iignatyev
parents:
49358
diff
changeset
|
2 |
* Copyright (c) 2015, 2018, 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:
40631
diff
changeset
|
27 |
* @requires vm.jvmci |
40076
1e283716fd17
8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization
dpochepk
parents:
40059
diff
changeset
|
28 |
* & (vm.compMode != "Xcomp" | vm.opt.TieredCompilation == null | vm.opt.TieredCompilation == true) |
1e283716fd17
8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization
dpochepk
parents:
40059
diff
changeset
|
29 |
* @summary no "-Xcomp -XX:-TieredCompilation" combination allowed until JDK-8140018 is resolved |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40076
diff
changeset
|
30 |
* @library / /test/lib |
36508 | 31 |
* @library ../common/patches |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36508
diff
changeset
|
32 |
* @modules java.base/jdk.internal.misc |
36508 | 33 |
* @modules 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.code |
|
49358 | 37 |
* jdk.internal.vm.ci/jdk.vm.ci.code.stack |
43972 | 38 |
* jdk.internal.vm.ci/jdk.vm.ci.meta |
40053
b3617982544e
8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents:
39291
diff
changeset
|
39 |
* |
43972 | 40 |
* @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:
39291
diff
changeset
|
41 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
b3617982544e
8160657: Compiler HotSpot tests should use the "run driver" directive where applicable
iignatyev
parents:
39291
diff
changeset
|
42 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
43 |
* @run main/othervm -Xmixed -Xbatch -Xbootclasspath/a:. |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
44 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
45 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
46 |
* -XX:CompileCommand=exclude,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::check |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
47 |
* -XX:CompileCommand=dontinline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::testFrame |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
48 |
* -XX:CompileCommand=dontinline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::testFrame2 |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
49 |
* -XX:CompileCommand=inline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::recurse |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
50 |
* -XX:+DoEscapeAnalysis -XX:-UseCounterDecay |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
51 |
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.materializeFirst=true |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
52 |
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
53 |
* compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
54 |
* @run main/othervm -Xmixed -Xbatch -Xbootclasspath/a:. |
36508 | 55 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
56 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
57 |
* -XX:CompileCommand=exclude,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::check |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
58 |
* -XX:CompileCommand=dontinline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::testFrame |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
59 |
* -XX:CompileCommand=dontinline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::testFrame2 |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
60 |
* -XX:CompileCommand=inline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::recurse |
40076
1e283716fd17
8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization
dpochepk
parents:
40059
diff
changeset
|
61 |
* -XX:+DoEscapeAnalysis -XX:-UseCounterDecay |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
62 |
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.materializeFirst=false |
36508 | 63 |
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=false |
64 |
* compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
65 |
* @run main/othervm -Xmixed -Xbatch -Xbootclasspath/a:. |
36508 | 66 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
67 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
68 |
* -XX:CompileCommand=exclude,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::check |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
69 |
* -XX:CompileCommand=dontinline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::testFrame |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
70 |
* -XX:CompileCommand=dontinline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::testFrame2 |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
71 |
* -XX:CompileCommand=inline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::recurse |
40076
1e283716fd17
8161508: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before materialization
dpochepk
parents:
40059
diff
changeset
|
72 |
* -XX:+DoEscapeAnalysis -XX:-UseCounterDecay |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
73 |
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.materializeFirst=true |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
74 |
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=true |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
75 |
* compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
76 |
* @run main/othervm -Xmixed -Xbatch -Xbootclasspath/a:. |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
77 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
78 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
79 |
* -XX:CompileCommand=exclude,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::check |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
80 |
* -XX:CompileCommand=dontinline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::testFrame |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
81 |
* -XX:CompileCommand=dontinline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::testFrame2 |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
82 |
* -XX:CompileCommand=inline,compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest::recurse |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
83 |
* -XX:+DoEscapeAnalysis -XX:-UseCounterDecay |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
84 |
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.materializeFirst=false |
36508 | 85 |
* -Dcompiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate=true |
86 |
* compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest |
|
33160 | 87 |
*/ |
88 |
||
89 |
package compiler.jvmci.compilerToVM; |
|
90 |
||
33632 | 91 |
import compiler.jvmci.common.CTVMUtilities; |
92 |
import compiler.testlibrary.CompilerUtils; |
|
38688
ad115177801f
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents:
38152
diff
changeset
|
93 |
import compiler.whitebox.CompilerWhiteBoxTest; |
40059 | 94 |
import jdk.test.lib.Asserts; |
49358 | 95 |
import jdk.vm.ci.code.stack.InspectedFrame; |
40059 | 96 |
import jdk.vm.ci.hotspot.CompilerToVMHelper; |
97 |
import jdk.vm.ci.hotspot.HotSpotStackFrameReference; |
|
98 |
import jdk.vm.ci.meta.ResolvedJavaMethod; |
|
51287
7b1ddbafa134
8208655: use JTreg skipped status in hotspot tests
iignatyev
parents:
49358
diff
changeset
|
99 |
import jtreg.SkippedException; |
40059 | 100 |
import sun.hotspot.WhiteBox; |
33632 | 101 |
|
40059 | 102 |
import java.lang.reflect.Method; |
33160 | 103 |
|
104 |
public class MaterializeVirtualObjectTest { |
|
38688
ad115177801f
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents:
38152
diff
changeset
|
105 |
private static final WhiteBox WB; |
ad115177801f
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents:
38152
diff
changeset
|
106 |
private static final boolean INVALIDATE; |
38700
6aa6444c1b48
8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents:
38688
diff
changeset
|
107 |
private static final int COMPILE_THRESHOLD; |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
108 |
private static final Method MATERIALIZED_METHOD; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
109 |
private static final Method NOT_MATERIALIZED_METHOD; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
110 |
private static final ResolvedJavaMethod MATERIALIZED_RESOLVED; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
111 |
private static final ResolvedJavaMethod NOT_MATERIALIZED_RESOLVED; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
112 |
private static final boolean MATERIALIZE_FIRST; |
33160 | 113 |
|
114 |
static { |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
115 |
Method method1; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
116 |
Method method2; |
38688
ad115177801f
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents:
38152
diff
changeset
|
117 |
WB = WhiteBox.getWhiteBox(); |
33160 | 118 |
try { |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
119 |
method1 = MaterializeVirtualObjectTest.class.getDeclaredMethod("testFrame", |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
120 |
String.class, int.class); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
121 |
method2 = MaterializeVirtualObjectTest.class.getDeclaredMethod("testFrame2", |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
122 |
String.class, int.class); |
33160 | 123 |
} catch (NoSuchMethodException e) { |
124 |
throw new Error("Can't get executable for test method", e); |
|
125 |
} |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
126 |
ResolvedJavaMethod resolved1; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
127 |
ResolvedJavaMethod resolved2; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
128 |
resolved1 = CTVMUtilities.getResolvedMethod(method1); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
129 |
resolved2 = CTVMUtilities.getResolvedMethod(method2); |
38688
ad115177801f
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents:
38152
diff
changeset
|
130 |
INVALIDATE = Boolean.getBoolean( |
38700
6aa6444c1b48
8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents:
38688
diff
changeset
|
131 |
"compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.invalidate"); |
6aa6444c1b48
8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents:
38688
diff
changeset
|
132 |
COMPILE_THRESHOLD = WB.getBooleanVMFlag("TieredCompilation") |
6aa6444c1b48
8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents:
38688
diff
changeset
|
133 |
? CompilerWhiteBoxTest.THRESHOLD |
6aa6444c1b48
8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents:
38688
diff
changeset
|
134 |
: CompilerWhiteBoxTest.THRESHOLD * 2; |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
135 |
MATERIALIZE_FIRST = Boolean.getBoolean( |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
136 |
"compiler.jvmci.compilerToVM.MaterializeVirtualObjectTest.materializeFirst"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
137 |
MATERIALIZED_RESOLVED = MATERIALIZE_FIRST ? resolved1 : resolved2; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
138 |
NOT_MATERIALIZED_RESOLVED = MATERIALIZE_FIRST ? resolved2 : resolved1; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
139 |
MATERIALIZED_METHOD = MATERIALIZE_FIRST ? method1 : method2; |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
140 |
NOT_MATERIALIZED_METHOD = MATERIALIZE_FIRST ? method2 : method1; |
33160 | 141 |
} |
142 |
||
33184
db796ab93ba7
8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents:
33160
diff
changeset
|
143 |
public static void main(String[] args) { |
db796ab93ba7
8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents:
33160
diff
changeset
|
144 |
int levels[] = CompilerUtils.getAvailableCompilationLevels(); |
db796ab93ba7
8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents:
33160
diff
changeset
|
145 |
// we need compilation level 4 to use EscapeAnalysis |
db796ab93ba7
8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents:
33160
diff
changeset
|
146 |
if (levels.length < 1 || levels[levels.length - 1] != 4) { |
51287
7b1ddbafa134
8208655: use JTreg skipped status in hotspot tests
iignatyev
parents:
49358
diff
changeset
|
147 |
throw new SkippedException("Test needs compilation level 4"); |
33184
db796ab93ba7
8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents:
33160
diff
changeset
|
148 |
} |
51287
7b1ddbafa134
8208655: use JTreg skipped status in hotspot tests
iignatyev
parents:
49358
diff
changeset
|
149 |
|
7b1ddbafa134
8208655: use JTreg skipped status in hotspot tests
iignatyev
parents:
49358
diff
changeset
|
150 |
new MaterializeVirtualObjectTest().test(); |
33160 | 151 |
} |
152 |
||
33184
db796ab93ba7
8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents:
33160
diff
changeset
|
153 |
private static String getName() { |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
154 |
return "CASE: invalidate=" + INVALIDATE + ", materializedMethod=" |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
155 |
+ (MATERIALIZE_FIRST ? "testFrame" : "testFrame2") |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
156 |
+ ", notMaterializedMethod=" |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
157 |
+ (MATERIALIZE_FIRST ? "testFrame2" : "testFrame"); |
33160 | 158 |
} |
159 |
||
160 |
private void test() { |
|
33184
db796ab93ba7
8139438: [TESTBUG] JVMCI test fails with RuntimeException: Has no virtual object before materialization
dpochepk
parents:
33160
diff
changeset
|
161 |
System.out.println(getName()); |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
162 |
Asserts.assertFalse(WB.isMethodCompiled(MATERIALIZED_METHOD), |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
163 |
getName() + " : materialized method is compiled"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
164 |
Asserts.assertFalse(WB.isMethodCompiled(NOT_MATERIALIZED_METHOD), |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
165 |
getName() + " : not materialized method is compiled"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
166 |
for (int i = 0; i < CompilerWhiteBoxTest.THRESHOLD; i++) { |
38688
ad115177801f
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents:
38152
diff
changeset
|
167 |
testFrame("someString", i); |
ad115177801f
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents:
38152
diff
changeset
|
168 |
} |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
169 |
Asserts.assertTrue(WB.isMethodCompiled(MATERIALIZED_METHOD), getName() |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
170 |
+ " : materialized method not compiled"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
171 |
Asserts.assertTrue(WB.isMethodCompiled(NOT_MATERIALIZED_METHOD), |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
172 |
getName() + " : not materialized method not compiled"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
173 |
testFrame("someString", /* materialize */ CompilerWhiteBoxTest.THRESHOLD); |
33160 | 174 |
} |
175 |
||
38688
ad115177801f
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents:
38152
diff
changeset
|
176 |
private void testFrame(String str, int iteration) { |
33160 | 177 |
Helper helper = new Helper(str); |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
178 |
testFrame2(str, iteration); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
179 |
Asserts.assertTrue((helper.string != null) && (this != null) |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
180 |
&& (helper != null), String.format("%s : some locals are null", getName())); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
181 |
} |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
182 |
|
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
183 |
private void testFrame2(String str, int iteration) { |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
184 |
Helper helper = new Helper(str); |
43672 | 185 |
recurse(2, iteration); |
33160 | 186 |
Asserts.assertTrue((helper.string != null) && (this != null) |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
187 |
&& (helper != null), String.format("%s : some locals are null", getName())); |
43672 | 188 |
} |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
189 |
|
43672 | 190 |
private void recurse(int depth, int iteration) { |
191 |
if (depth == 0) { |
|
192 |
check(iteration); |
|
193 |
} else { |
|
194 |
Integer s = new Integer(depth); |
|
195 |
recurse(depth - 1, iteration); |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
196 |
Asserts.assertEQ(s.intValue(), depth, |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
197 |
String.format("different values: %s != %s", s.intValue(), depth)); |
43672 | 198 |
} |
33160 | 199 |
} |
200 |
||
38688
ad115177801f
8139703: [TESTBUG] compiler/jvmci/compilerToVM/MaterializeVirtualObjectTest fails using -Xcomp
dpochepk
parents:
38152
diff
changeset
|
201 |
private void check(int iteration) { |
33160 | 202 |
// Materialize virtual objects on last invocation |
38700
6aa6444c1b48
8157438: JVMCI: MaterializeVirtualObjectTest fails w/ "CASE: invalidate=true: has no virtual object before"
dpochepk
parents:
38688
diff
changeset
|
203 |
if (iteration == COMPILE_THRESHOLD) { |
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
204 |
// get frames and check not-null |
49358 | 205 |
HotSpotStackFrameReference materialized = CompilerToVMHelper.iterateFrames( |
206 |
new ResolvedJavaMethod[] {MATERIALIZED_RESOLVED}, |
|
207 |
null /* any */, |
|
208 |
0, |
|
209 |
f -> (HotSpotStackFrameReference) f); |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
210 |
Asserts.assertNotNull(materialized, getName() |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
211 |
+ " : got null frame for materialized method"); |
49358 | 212 |
Asserts.assertTrue(materialized.isMethod(MATERIALIZED_RESOLVED), |
213 |
"Expected materialized method but got " + materialized); |
|
214 |
InspectedFrame notMaterialized = CompilerToVMHelper.iterateFrames( |
|
215 |
new ResolvedJavaMethod[] {NOT_MATERIALIZED_RESOLVED}, |
|
216 |
null /* any */, |
|
217 |
0, |
|
218 |
f -> f); |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
219 |
Asserts.assertNE(materialized, notMaterialized, |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
220 |
"Got same frame pointer for both tested frames"); |
49358 | 221 |
Asserts.assertTrue(notMaterialized.isMethod(NOT_MATERIALIZED_RESOLVED), |
222 |
"Expected notMaterialized method but got " + notMaterialized); |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
223 |
Asserts.assertNotNull(notMaterialized, getName() |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
224 |
+ " : got null frame for not materialized method"); |
49358 | 225 |
Asserts.assertTrue(WB.isMethodCompiled(MATERIALIZED_METHOD), getName() |
226 |
+ " : materialized method not compiled"); |
|
227 |
Asserts.assertTrue(WB.isMethodCompiled(NOT_MATERIALIZED_METHOD), |
|
228 |
getName() + " : not materialized method not compiled"); |
|
43961
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
229 |
// check that frames has virtual objects before materialization stage |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
230 |
Asserts.assertTrue(materialized.hasVirtualObjects(), getName() |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
231 |
+ ": materialized frame has no virtual object before materialization"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
232 |
Asserts.assertTrue(notMaterialized.hasVirtualObjects(), getName() |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
233 |
+ ": notMaterialized frame has no virtual object before materialization"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
234 |
// materialize |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
235 |
CompilerToVMHelper.materializeVirtualObjects(materialized, INVALIDATE); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
236 |
// check that only not materialized frame has virtual objects |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
237 |
Asserts.assertFalse(materialized.hasVirtualObjects(), getName() |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
238 |
+ " : materialized has virtual object after materialization"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
239 |
Asserts.assertTrue(notMaterialized.hasVirtualObjects(), getName() |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
240 |
+ " : notMaterialized has no virtual object after materialization"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
241 |
// check that materialized frame was deoptimized in case invalidate=true |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
242 |
Asserts.assertEQ(WB.isMethodCompiled(MATERIALIZED_METHOD), !INVALIDATE, getName() |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
243 |
+ " : materialized method has unexpected compiled status"); |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
244 |
// check that not materialized frame wasn't deoptimized |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
245 |
Asserts.assertTrue(WB.isMethodCompiled(NOT_MATERIALIZED_METHOD), getName() |
441de9600d40
8138799: improve tests for CompilerToVM::MaterializeVirtualObjectTest
dpochepk
parents:
43672
diff
changeset
|
246 |
+ " : not materialized method has unexpected compiled status"); |
33160 | 247 |
} |
248 |
} |
|
249 |
||
250 |
private class Helper { |
|
251 |
public String string; |
|
252 |
||
253 |
public Helper(String s) { |
|
254 |
this.string = s; |
|
255 |
} |
|
256 |
} |
|
257 |
} |