author | kvn |
Thu, 16 Feb 2017 15:46:09 -0800 | |
changeset 43972 | 1ade39b8381b |
parent 43957 | 9ae31c0b2148 |
child 44836 | 45196b7066e3 |
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 |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
42 |
* compiler.jvmci.compilerToVM.IsCompilableTest |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
43 |
* @run main/othervm -Xbootclasspath/a:. |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
44 |
* -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI |
43957
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
45 |
* -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI -XX:-UseJVMCICompiler |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
46 |
* compiler.jvmci.compilerToVM.IsCompilableTest |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
47 |
*/ |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
48 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
49 |
package compiler.jvmci.compilerToVM; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
50 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
51 |
import compiler.jvmci.common.CTVMUtilities; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
52 |
import jdk.test.lib.Asserts; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
53 |
import jdk.vm.ci.hotspot.CompilerToVMHelper; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
54 |
import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
55 |
import sun.hotspot.WhiteBox; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
56 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
57 |
import java.lang.reflect.Executable; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
58 |
import java.util.ArrayList; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
59 |
import java.util.Arrays; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
60 |
import java.util.List; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
61 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
62 |
public class IsCompilableTest { |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
63 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
64 |
private static final WhiteBox WB = WhiteBox.getWhiteBox(); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
65 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
66 |
public static void main(String[] args) { |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
67 |
List<Executable> testCases = createTestCases(); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
68 |
testCases.forEach(IsCompilableTest::runSanityTest); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
69 |
} |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
70 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
71 |
private static void runSanityTest(Executable aMethod) { |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
72 |
HotSpotResolvedJavaMethod method = CTVMUtilities |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
73 |
.getResolvedMethod(aMethod); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
74 |
boolean isCompilable = CompilerToVMHelper.isCompilable(method); |
43957
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
75 |
boolean expected = WB.isMethodCompilable(aMethod); |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
76 |
Asserts.assertEQ(isCompilable, expected, "Unexpected initial " + |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
77 |
"value of property 'compilable'"); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
78 |
|
43957
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
79 |
WB.makeMethodNotCompilable(aMethod); |
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
80 |
isCompilable = CompilerToVMHelper.isCompilable(method); |
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
81 |
Asserts.assertFalse(isCompilable, aMethod + "Unexpected value of " + |
9ae31c0b2148
8174961: [JVMCI] incorrect implementation of isCompilable
dnsimon
parents:
43476
diff
changeset
|
82 |
"property 'isCompilable' after setting 'compilable' to false"); |
43476
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
83 |
} |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
84 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
85 |
private static List<Executable> createTestCases() { |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
86 |
List<Executable> testCases = new ArrayList<>(); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
87 |
|
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
88 |
Class<?> aClass = DummyClass.class; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
89 |
testCases.addAll(Arrays.asList(aClass.getDeclaredMethods())); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
90 |
testCases.addAll(Arrays.asList(aClass.getDeclaredConstructors())); |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
91 |
return testCases; |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
92 |
} |
b7404901db14
8172733: [JVMCI] add ResolvedJavaMethod.hasNeverInlineDirective
dnsimon
parents:
diff
changeset
|
93 |
} |