30 * @library ../common/patches
31 * @modules java.base/jdk.internal.misc
32 * @modules java.base/jdk.internal.org.objectweb.asm
33 * java.base/jdk.internal.org.objectweb.asm.tree
34 * jdk.vm.ci/jdk.vm.ci.hotspot
35 * jdk.vm.ci/jdk.vm.ci.code
36 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
37 * @build compiler.jvmci.compilerToVM.ShouldInlineMethodTest
38 * @build sun.hotspot.WhiteBox
39 * @run main ClassFileInstaller sun.hotspot.WhiteBox
40 * sun.hotspot.WhiteBox$WhiteBoxPermission
41 * @run main/othervm -Xbootclasspath/a:.
42 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
43 * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
44 * compiler.jvmci.compilerToVM.ShouldInlineMethodTest
45 */
46
47 package compiler.jvmci.compilerToVM;
48
49 import compiler.jvmci.common.CTVMUtilities;
50 import java.lang.reflect.Executable;
51 import java.util.ArrayList;
52 import java.util.Arrays;
53 import java.util.List;
54 import jdk.vm.ci.hotspot.CompilerToVMHelper;
55 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
56 import jdk.test.lib.Asserts;
57 import sun.hotspot.WhiteBox;
58
59 public class ShouldInlineMethodTest {
60
61 private static final WhiteBox WB = WhiteBox.getWhiteBox();
62
63 public static void main(String[] args) {
64 List<Executable> testCases = createTestCases();
65 testCases.forEach(ShouldInlineMethodTest::runSanityTest);
66 }
67
68 private static void runSanityTest(Executable aMethod) {
69 HotSpotResolvedJavaMethod method = CTVMUtilities
70 .getResolvedMethod(aMethod);
71 boolean shouldInline = CompilerToVMHelper.shouldInlineMethod(method);
72 boolean expectedShouldInline = WB.testSetForceInlineMethod(aMethod,
73 true);
74 Asserts.assertEQ(shouldInline, expectedShouldInline,
75 "Unexpected value of property 'should inline'");
76
77 shouldInline = CompilerToVMHelper.shouldInlineMethod(method);
|
30 * @library ../common/patches
31 * @modules java.base/jdk.internal.misc
32 * @modules java.base/jdk.internal.org.objectweb.asm
33 * java.base/jdk.internal.org.objectweb.asm.tree
34 * jdk.vm.ci/jdk.vm.ci.hotspot
35 * jdk.vm.ci/jdk.vm.ci.code
36 * @build jdk.vm.ci/jdk.vm.ci.hotspot.CompilerToVMHelper
37 * @build compiler.jvmci.compilerToVM.ShouldInlineMethodTest
38 * @build sun.hotspot.WhiteBox
39 * @run main ClassFileInstaller sun.hotspot.WhiteBox
40 * sun.hotspot.WhiteBox$WhiteBoxPermission
41 * @run main/othervm -Xbootclasspath/a:.
42 * -XX:+UnlockDiagnosticVMOptions -XX:+WhiteBoxAPI
43 * -XX:+UnlockExperimentalVMOptions -XX:+EnableJVMCI
44 * compiler.jvmci.compilerToVM.ShouldInlineMethodTest
45 */
46
47 package compiler.jvmci.compilerToVM;
48
49 import compiler.jvmci.common.CTVMUtilities;
50 import jdk.test.lib.Asserts;
51 import jdk.vm.ci.hotspot.CompilerToVMHelper;
52 import jdk.vm.ci.hotspot.HotSpotResolvedJavaMethod;
53 import sun.hotspot.WhiteBox;
54
55 import java.lang.reflect.Executable;
56 import java.util.ArrayList;
57 import java.util.Arrays;
58 import java.util.List;
59
60 public class ShouldInlineMethodTest {
61
62 private static final WhiteBox WB = WhiteBox.getWhiteBox();
63
64 public static void main(String[] args) {
65 List<Executable> testCases = createTestCases();
66 testCases.forEach(ShouldInlineMethodTest::runSanityTest);
67 }
68
69 private static void runSanityTest(Executable aMethod) {
70 HotSpotResolvedJavaMethod method = CTVMUtilities
71 .getResolvedMethod(aMethod);
72 boolean shouldInline = CompilerToVMHelper.shouldInlineMethod(method);
73 boolean expectedShouldInline = WB.testSetForceInlineMethod(aMethod,
74 true);
75 Asserts.assertEQ(shouldInline, expectedShouldInline,
76 "Unexpected value of property 'should inline'");
77
78 shouldInline = CompilerToVMHelper.shouldInlineMethod(method);
|