author | kvn |
Wed, 01 May 2019 12:31:29 -0700 | |
changeset 54669 | ad45b3802d4e |
parent 47216 | 71c04702a3d5 |
child 55206 | 2fe2063fe567 |
child 58678 | 9cf78a70fa4f |
permissions | -rw-r--r-- |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
1 |
/* |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
2 |
* Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved. |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
3 |
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
4 |
* |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
5 |
* This code is free software; you can redistribute it and/or modify it |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
6 |
* under the terms of the GNU General Public License version 2 only, as |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
7 |
* published by the Free Software Foundation. |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
8 |
* |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
9 |
* This code is distributed in the hope that it will be useful, but WITHOUT |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
10 |
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
11 |
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
12 |
* version 2 for more details (a copy is included in the LICENSE file that |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
13 |
* accompanied this code). |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
14 |
* |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
15 |
* You should have received a copy of the GNU General Public License version |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
16 |
* 2 along with this work; if not, write to the Free Software Foundation, |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
17 |
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
18 |
* |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
19 |
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
20 |
* or visit www.oracle.com if you need additional information or have any |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
21 |
* questions. |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
22 |
*/ |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
23 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
24 |
/** |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
25 |
* @test |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
26 |
* @bug 8136421 |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
27 |
* @requires vm.jvmci |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
28 |
* @library /test/lib / |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
29 |
* @library ../common/patches |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
30 |
* @modules java.base/jdk.internal.misc |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
31 |
* @modules java.base/jdk.internal.org.objectweb.asm |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
32 |
* java.base/jdk.internal.org.objectweb.asm.tree |
43972 | 33 |
* jdk.internal.vm.ci/jdk.vm.ci.hotspot |
34 |
* jdk.internal.vm.ci/jdk.vm.ci.code |
|
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
35 |
* |
43972 | 36 |
* @build jdk.internal.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper sun.hotspot.WhiteBox |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
37 |
* @run driver ClassFileInstaller sun.hotspot.WhiteBox |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
38 |
* sun.hotspot.WhiteBox$WhiteBoxPermission |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
39 |
* @run main/othervm -Xbootclasspath/a:. |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
40 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
41 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:+UseJVMCICompiler |
44836 | 42 |
* -Djvmci.Compiler=null |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
43 |
* compiler.jvmci.compilerToVM.IsCompilableTest |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
44 |
* @run main/othervm -Xbootclasspath/a:. |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
45 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
43957
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
46 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler |
44836 | 47 |
* -Djvmci.Compiler=null |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
48 |
* compiler.jvmci.compilerToVM.IsCompilableTest |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
49 |
*/ |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
50 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
51 |
package compiler.jvmci.compilerToVM; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
52 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
53 |
import compiler.jvmci.common.CTVMUtilities; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
54 |
import jdk.test.lib.Asserts; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
55 |
import jdk.vm.ci.hotspot.CompilerToVMHelper; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
56 |
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
57 |
import sun.hotspot.WhiteBox; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
58 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
59 |
import java.lang.reflect.Executable; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
60 |
import java.util.ArrayList; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
61 |
import java.util.Arrays; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
62 |
import java.util.List; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
63 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
64 |
public class IsCompilableTest { |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
65 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
66 |
private static final WhiteBox WB = WhiteBox.getWhiteBox(); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
67 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
68 |
public static void main(String[] args) { |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
69 |
List<Executable> testCases = createTestCases(); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
70 |
testCases.forEach(IsCompilableTest::runSanityTest); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
71 |
} |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
72 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
73 |
private static void runSanityTest(Executable aMethod) { |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
74 |
HotSpotResolvedJavaMethod method = CTVMUtilities |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
75 |
.getResolvedMethod(aMethod); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
76 |
boolean isCompilable = CompilerToVMHelper.isCompilable(method); |
43957
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
77 |
boolean expected = WB.isMethodCompilable(aMethod); |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
78 |
Asserts.assertEQ(isCompilable, expected, "Unexpected initial " + |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
79 |
"value of property 'compilable'"); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
80 |
|
43957
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
81 |
WB.makeMethodNotCompilable(aMethod); |
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
82 |
isCompilable = CompilerToVMHelper.isCompilable(method); |
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
83 |
Asserts.assertFalse(isCompilable, aMethod + "Unexpected value of " + |
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
84 |
"property 'isCompilable' after setting 'compilable' to false"); |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
85 |
} |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
86 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
87 |
private static List<Executable> createTestCases() { |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
88 |
List<Executable> testCases = new ArrayList<>(); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
89 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
90 |
Class<?> aClass = DummyClass.class; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
91 |
testCases.addAll(Arrays.asList(aClass.getDeclaredMethods())); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
92 |
testCases.addAll(Arrays.asList(aClass.getDeclaredConstructors())); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
93 |
return testCases; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
94 |
} |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
95 |
} |