author | iignatyev |
Tue, 05 Nov 2019 08:57:36 -0800 | |
changeset 58937 | ba99c5a4491d |
parent 57681 | 41f2f2829a09 |
permissions | -rw-r--r-- |
42650 | 1 |
/* |
57681 | 2 |
* Copyright (c) 2016, 2019, 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 / |
28 |
* @modules java.base/jdk.internal.misc |
|
29 |
* @build compiler.aot.RecompilationTest |
|
58937
ba99c5a4491d
8233496: AOT tests failures with 'java.lang.RuntimeException: Failed to find sun/hotspot/WhiteBox.class'
iignatyev
parents:
57681
diff
changeset
|
30 |
* sun.hotspot.WhiteBox |
48791
6e079ff6c83c
8186635: ClassFileInstaller should be run as a driver
iignatyev
parents:
47216
diff
changeset
|
31 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
42650 | 32 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
48796
5264a11d3753
8195729: compiler.aot.AotCompiler should be run as a driver
iignatyev
parents:
48791
diff
changeset
|
33 |
* @run driver compiler.aot.AotCompiler -libname libRecompilationTest1.so |
42650 | 34 |
* -class compiler.whitebox.SimpleTestCaseHelper |
35 |
* -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
|
36 |
* -extraopt -Dgraal.ProbabilisticProfiling=false |
42650 | 37 |
* -extraopt -XX:+UnlockDiagnosticVMOptions -extraopt -XX:+WhiteBoxAPI -extraopt -Xbootclasspath/a:. |
42657
9e1850986b28
8171134: Unexpected output in compiler/aot/SharedUsageTest.java
kvn
parents:
42650
diff
changeset
|
38 |
* -extraopt -XX:-UseCompressedOops |
42662
ba98de0931bb
8171276: More problems in compiler/aot/RecompilationTest.java tests
kvn
parents:
42660
diff
changeset
|
39 |
* -extraopt -XX:CompileCommand=dontinline,compiler.whitebox.SimpleTestCaseHelper::* |
48796
5264a11d3753
8195729: compiler.aot.AotCompiler should be run as a driver
iignatyev
parents:
48791
diff
changeset
|
40 |
* @run driver compiler.aot.AotCompiler -libname libRecompilationTest2.so |
42650 | 41 |
* -class compiler.whitebox.SimpleTestCaseHelper |
42 |
* -extraopt -Dgraal.TieredAOT=false |
|
43 |
* -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
|
44 |
* -extraopt -XX:-UseCompressedOops |
42662
ba98de0931bb
8171276: More problems in compiler/aot/RecompilationTest.java tests
kvn
parents:
42660
diff
changeset
|
45 |
* -extraopt -XX:CompileCommand=dontinline,compiler.whitebox.SimpleTestCaseHelper::* |
57681 | 46 |
* @run main/othervm -Xmixed -Xbatch -XX:+UnlockExperimentalVMOptions -XX:+UseAOT -XX:-TieredCompilation |
42660
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
47 |
* -XX:-UseCounterDecay -XX:-UseCompressedOops |
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
48 |
* -XX:-Inline |
90e411b50d88
8171187: Expected compilation level after compilation to be no less than 1
kvn
parents:
42657
diff
changeset
|
49 |
* -XX:AOTLibrary=./libRecompilationTest2.so -Xbootclasspath/a:. |
42650 | 50 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
51 |
* -Dcompiler.aot.RecompilationTest.check_level=-1 |
|
52 |
* compiler.aot.RecompilationTest |
|
53 |
* @summary check if recompilation after aot goes fine |
|
54 |
*/ |
|
55 |
||
56 |
/* having whitebox-related options for aot compiler is a temporary solution, |
|
57 |
because of JDK-8146201 |
|
58 |
*/ |
|
59 |
||
60 |
package compiler.aot; |
|
61 |
||
62 |
import compiler.whitebox.CompilerWhiteBoxTest; |
|
63 |
import java.lang.reflect.Executable; |
|
64 |
import jdk.test.lib.Asserts; |
|
65 |
||
66 |
public final class RecompilationTest extends CompilerWhiteBoxTest { |
|
67 |
private static final int CHECK_LEVEL = Integer.getInteger( |
|
68 |
"compiler.aot.RecompilationTest.check_level"); |
|
69 |
||
70 |
public static void main(String args[]) { |
|
71 |
CompilerWhiteBoxTest.main(RecompilationTest::new, args); |
|
72 |
} |
|
73 |
||
74 |
private RecompilationTest(TestCase testCase) { |
|
75 |
super(testCase); |
|
76 |
} |
|
77 |
||
78 |
@Override |
|
79 |
protected void test() throws Exception { |
|
80 |
if (testCase.isOsr()) { |
|
81 |
/* aot compiler is not using osr compilation */ |
|
82 |
System.out.println("Skipping OSR case"); |
|
83 |
return; |
|
84 |
} |
|
85 |
Executable e = testCase.getExecutable(); |
|
86 |
Asserts.assertTrue(WHITE_BOX.isMethodCompiled(e), |
|
87 |
testCase.name() + ": an executable expected to be compiled"); |
|
88 |
Asserts.assertEQ(WHITE_BOX.getMethodCompilationLevel(e), |
|
89 |
COMP_LEVEL_AOT, |
|
90 |
String.format("%s: unexpected compilation level at start", |
|
91 |
testCase.name())); |
|
92 |
compile(); |
|
93 |
Asserts.assertTrue(WHITE_BOX.isMethodCompiled(e), testCase.name() |
|
94 |
+ ": method expected to be compiled"); |
|
95 |
/* a case with AOT'ed code checks exact compilation level equality |
|
96 |
while another case checks minimum level and if method compiled |
|
97 |
because there might be different compilation level transitions */ |
|
98 |
if (CHECK_LEVEL != COMP_LEVEL_AOT) { |
|
99 |
Asserts.assertGTE(WHITE_BOX.getMethodCompilationLevel(e), |
|
100 |
CHECK_LEVEL, |
|
101 |
String.format("%s: expected compilation level" |
|
102 |
+ " after compilation to be no less than %d for %s", |
|
103 |
testCase.name(), CHECK_LEVEL, testCase.name())); |
|
104 |
} else { |
|
105 |
Asserts.assertEQ(WHITE_BOX.getMethodCompilationLevel(e), |
|
106 |
COMP_LEVEL_AOT, String.format("%s: expected compilation" |
|
107 |
+ " level after compilation to be equal to %d for %s", |
|
108 |
testCase.name(), COMP_LEVEL_AOT, testCase.name())); |
|
109 |
} |
|
110 |
} |
|
111 |
} |