author | iignatyev |
Wed, 02 Aug 2017 08:53:18 -0700 | |
changeset 46743 | 4d9e00487c62 |
parent 46725 | 537540cbebb3 |
child 46942 | de1adae7cbc3 |
permissions | -rw-r--r-- |
42650 | 1 |
/* |
46260
5de61384fba6
8172670: AOT Platform Support for Windows and Mac OS X x64
bobv
parents:
42662
diff
changeset
|
2 |
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved. |
42650 | 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 |
|
46743
4d9e00487c62
8185536: @key aot should be replaced w/ @requires vm.aot
iignatyev
parents:
46725
diff
changeset
|
26 |
* @requires vm.aot |
42650 | 27 |
* @library /test/lib /testlibrary / |
46267 | 28 |
* @requires vm.bits == "64" & (os.arch == "amd64" | os.arch == "x86_64") |
42650 | 29 |
* @modules java.base/jdk.internal.misc |
30 |
* @build compiler.aot.RecompilationTest |
|
31 |
* compiler.aot.AotCompiler |
|
32 |
* @run main ClassFileInstaller sun.hotspot.WhiteBox |
|
33 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
|
42660
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
34 |
* @run main compiler.aot.AotCompiler -libname libRecompilationTest1.so |
42650 | 35 |
* -class compiler.whitebox.SimpleTestCaseHelper |
36 |
* -extraopt -Dgraal.TieredAOT=true -extraopt -Dgraal.ProfileSimpleMethods=true |
|
43427
543d79a36774
8172010: [AOT] RecompilationTest.java fails with "expected compilation level after compilation to be no less than 1"
thartmann
parents:
42662
diff
changeset
|
37 |
* -extraopt -Dgraal.ProbabilisticProfiling=false |
42650 | 38 |
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:. |
42657
9e1850986b28
8171134: Unexpected output in compiler/aot/SharedUsageTest.java
kvn
parents:
42650
diff
changeset
|
39 |
* -extraopt -XX:-UseCompressedOops |
42662
ba98de0931bb
8171276: More problems in compiler/aot/RecompilationTest.java tests
kvn
parents:
42660
diff
changeset
|
40 |
* -extraopt -XX:CompileCommand=dontinline,compiler.whitebox.SimpleTestCaseHelper::* |
42657
9e1850986b28
8171134: Unexpected output in compiler/aot/SharedUsageTest.java
kvn
parents:
42650
diff
changeset
|
41 |
* @run main/othervm -Xmixed -Xbatch -XX:+UseAOT -XX:+TieredCompilation |
9e1850986b28
8171134: Unexpected output in compiler/aot/SharedUsageTest.java
kvn
parents:
42650
diff
changeset
|
42 |
* -XX:-UseCounterDecay -XX:-UseCompressedOops |
42660
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
43 |
* -XX:-Inline |
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
44 |
* -XX:AOTLibrary=./libRecompilationTest1.so -Xbootclasspath/a:. |
42650 | 45 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
46 |
* -Dcompiler.aot.RecompilationTest.check_level=1 |
|
47 |
* compiler.aot.RecompilationTest |
|
42660
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
48 |
* @run main compiler.aot.AotCompiler -libname libRecompilationTest2.so |
42650 | 49 |
* -class compiler.whitebox.SimpleTestCaseHelper |
50 |
* -extraopt -Dgraal.TieredAOT=false |
|
51 |
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:. |
|
42660
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
52 |
* -extraopt -XX:-UseCompressedOops |
42662
ba98de0931bb
8171276: More problems in compiler/aot/RecompilationTest.java tests
kvn
parents:
42660
diff
changeset
|
53 |
* -extraopt -XX:CompileCommand=dontinline,compiler.whitebox.SimpleTestCaseHelper::* |
42660
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
54 |
* @run main/othervm -Xmixed -Xbatch -XX:+UseAOT -XX:+TieredCompilation |
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
55 |
* -XX:-UseCounterDecay -XX:-UseCompressedOops |
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
56 |
* -XX:-Inline |
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
57 |
* -XX:AOTLibrary=./libRecompilationTest2.so -Xbootclasspath/a:. |
42650 | 58 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
59 |
* -Dcompiler.aot.RecompilationTest.check_level=-1 |
|
60 |
* compiler.aot.RecompilationTest |
|
42660
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
61 |
* @run main/othervm -Xmixed -Xbatch -XX:+UseAOT -XX:-TieredCompilation |
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
62 |
* -XX:-UseCounterDecay -XX:-UseCompressedOops |
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
63 |
* -XX:-Inline |
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
64 |
* -XX:AOTLibrary=./libRecompilationTest2.so -Xbootclasspath/a:. |
42650 | 65 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
66 |
* -Dcompiler.aot.RecompilationTest.check_level=-1 |
|
67 |
* compiler.aot.RecompilationTest |
|
68 |
* @summary check if recompilation after aot goes fine |
|
69 |
*/ |
|
70 |
||
71 |
/* having whitebox-related options for aot compiler is a temporary solution, |
|
72 |
because of JDK-8146201 |
|
73 |
*/ |
|
74 |
||
75 |
package compiler.aot; |
|
76 |
||
77 |
import compiler.whitebox.CompilerWhiteBoxTest; |
|
78 |
import java.lang.reflect.Executable; |
|
79 |
import jdk.test.lib.Asserts; |
|
80 |
||
81 |
public final class RecompilationTest extends CompilerWhiteBoxTest { |
|
82 |
private static final int CHECK_LEVEL = Integer.getInteger( |
|
83 |
"compiler.aot.RecompilationTest.check_level"); |
|
84 |
||
85 |
public static void main(String args[]) { |
|
86 |
CompilerWhiteBoxTest.main(RecompilationTest::new, args); |
|
87 |
} |
|
88 |
||
89 |
private RecompilationTest(TestCase testCase) { |
|
90 |
super(testCase); |
|
91 |
} |
|
92 |
||
93 |
@Override |
|
94 |
protected void test() throws Exception { |
|
95 |
if (testCase.isOsr()) { |
|
96 |
/* aot compiler is not using osr compilation */ |
|
97 |
System.out.println("Skipping OSR case"); |
|
98 |
return; |
|
99 |
} |
|
100 |
Executable e = testCase.getExecutable(); |
|
101 |
Asserts.assertTrue(WHITE_BOX.isMethodCompiled(e), |
|
102 |
testCase.name() + ": an executable expected to be compiled"); |
|
103 |
Asserts.assertEQ(WHITE_BOX.getMethodCompilationLevel(e), |
|
104 |
COMP_LEVEL_AOT, |
|
105 |
String.format("%s: unexpected compilation level at start", |
|
106 |
testCase.name())); |
|
107 |
compile(); |
|
108 |
Asserts.assertTrue(WHITE_BOX.isMethodCompiled(e), testCase.name() |
|
109 |
+ ": method expected to be compiled"); |
|
110 |
/* a case with AOT'ed code checks exact compilation level equality |
|
111 |
while another case checks minimum level and if method compiled |
|
112 |
because there might be different compilation level transitions */ |
|
113 |
if (CHECK_LEVEL != COMP_LEVEL_AOT) { |
|
114 |
Asserts.assertGTE(WHITE_BOX.getMethodCompilationLevel(e), |
|
115 |
CHECK_LEVEL, |
|
116 |
String.format("%s: expected compilation level" |
|
117 |
+ " after compilation to be no less than %d for %s", |
|
118 |
testCase.name(), CHECK_LEVEL, testCase.name())); |
|
119 |
} else { |
|
120 |
Asserts.assertEQ(WHITE_BOX.getMethodCompilationLevel(e), |
|
121 |
COMP_LEVEL_AOT, String.format("%s: expected compilation" |
|
122 |
+ " level after compilation to be equal to %d for %s", |
|
123 |
testCase.name(), COMP_LEVEL_AOT, testCase.name())); |
|
124 |
} |
|
125 |
} |
|
126 |
} |