author | iveresov |
Fri, 19 Aug 2016 15:29:57 -0700 | |
changeset 40866 | 3eef10047a6b |
parent 40631 | ed82623d7831 |
child 42607 | acd91f1875d4 |
permissions | -rw-r--r-- |
33160 | 1 |
/* |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40067
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 |
|
39291
a4efe145313d
8157831: JVMCI tests should not be executed on linux-arm32
lmesnik
parents:
38152
diff
changeset
|
27 |
* @requires (vm.simpleArch == "x64" | vm.simpleArch == "sparcv9" | vm.simpleArch == "aarch64") |
40631
ed82623d7831
8157957: ClassNotFoundException: jdk.test.lib.JDKToolFinder
ctornqvi
parents:
40067
diff
changeset
|
28 |
* @library / /test/lib |
40067
db6c74a53556
8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents:
40059
diff
changeset
|
29 |
* ../common/patches |
38152
80e5da81fb2c
8154258: [TESTBUG] Various serviceability tests fail compilation
dsamersoff
parents:
36508
diff
changeset
|
30 |
* @modules java.base/jdk.internal.misc |
40067
db6c74a53556
8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents:
40059
diff
changeset
|
31 |
* jdk.vm.ci/jdk.vm.ci.hotspot |
db6c74a53556
8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents:
40059
diff
changeset
|
32 |
* |
36508 | 33 |
* @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper |
40067
db6c74a53556
8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents:
40059
diff
changeset
|
34 |
* sun.hotspot.WhiteBox |
db6c74a53556
8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents:
40059
diff
changeset
|
35 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
db6c74a53556
8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents:
40059
diff
changeset
|
36 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
36508 | 37 |
* @run main/othervm -Xbootclasspath/a:. |
38 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
|
39 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI |
|
40 |
* compiler.jvmci.compilerToVM.IsMatureTest |
|
33160 | 41 |
*/ |
34219
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
42 |
|
33160 | 43 |
package compiler.jvmci.compilerToVM; |
44 |
||
45 |
import compiler.jvmci.common.testcases.SimpleClass; |
|
34219
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
46 |
import compiler.whitebox.CompilerWhiteBoxTest; |
40059 | 47 |
import jdk.test.lib.Asserts; |
40067
db6c74a53556
8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents:
40059
diff
changeset
|
48 |
import jdk.test.lib.Platform; |
33160 | 49 |
import jdk.vm.ci.hotspot.CompilerToVMHelper; |
50 |
import sun.hotspot.WhiteBox; |
|
51 |
||
52 |
import java.lang.reflect.Executable; |
|
53 |
||
54 |
public class IsMatureTest { |
|
55 |
private static final WhiteBox WB = WhiteBox.getWhiteBox(); |
|
34219
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
56 |
private static final boolean TIERED |
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
57 |
= WB.getBooleanVMFlag("TieredCompilation"); |
33160 | 58 |
|
59 |
public static void main(String[] args) throws Exception { |
|
60 |
new IsMatureTest().test(); |
|
61 |
} |
|
62 |
||
63 |
public void test() throws Exception { |
|
64 |
SimpleClass sclass = new SimpleClass(); |
|
65 |
Executable method = SimpleClass.class.getDeclaredMethod("testMethod"); |
|
34219
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
66 |
long methodData = WB.getMethodData(method); |
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
67 |
boolean isMature = CompilerToVMHelper.isMature(methodData); |
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
68 |
Asserts.assertEQ(methodData, 0L, |
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
69 |
"Never invoked method can't have method data"); |
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
70 |
Asserts.assertFalse(isMature, "Never invoked method can't be mature"); |
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
71 |
for (int i = 0; i < CompilerWhiteBoxTest.THRESHOLD; i++) { |
33160 | 72 |
sclass.testMethod(); |
73 |
} |
|
34219
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
74 |
methodData = WB.getMethodData(method); |
eb43fec35c99
8139384: [TESTBUG] JVMCI test fails with java.lang.RuntimeException: a 100_000 times invoked method should be mature
dpochepk
parents:
33730
diff
changeset
|
75 |
isMature = CompilerToVMHelper.isMature(methodData); |
39447
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
76 |
int compLevel = WB.getMethodCompilationLevel(method); |
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
77 |
// methodData doesn't necessarily exist for interpreter and compilation level 1 |
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
78 |
if (compLevel != CompilerWhiteBoxTest.COMP_LEVEL_NONE |
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
79 |
&& compLevel != CompilerWhiteBoxTest.COMP_LEVEL_SIMPLE) { |
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
80 |
Asserts.assertNE(methodData, 0L, |
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
81 |
"Multiple times invoked method should have method data"); |
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
82 |
/* a method is not mature in Xcomp mode with tiered compilation disabled, |
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
83 |
see NonTieredCompPolicy::is_mature */ |
40067
db6c74a53556
8151280: update hotspot tests to use vm.compMode instead of their own logic
tpivovarova
parents:
40059
diff
changeset
|
84 |
Asserts.assertEQ(isMature, !(Platform.isComp() && !TIERED), |
39447
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
85 |
"Unexpected isMature state for multiple times invoked method"); |
6de9e469842e
8159730: compiler/jvmci/compilerToVM/IsMatureTest failed with "Multiple times invoked method should have method data (assert failed: 0 != 0)"
dpochepk
parents:
38152
diff
changeset
|
86 |
} |
33160 | 87 |
} |
88 |
} |