54 import java.lang.reflect.Executable; 55 import java.util.ArrayList; 56 import java.util.Arrays; 57 import java.util.List; 58 59 public class DoNotInlineOrCompileTest { 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(DoNotInlineOrCompileTest::runSanityTest); 66 } 67 68 private static void runSanityTest(Executable aMethod) { 69 HotSpotResolvedJavaMethod method = CTVMUtilities 70 .getResolvedMethod(aMethod); 71 boolean hasNeverInlineDirective = CompilerToVMHelper.hasNeverInlineDirective(method); 72 Asserts.assertFalse(hasNeverInlineDirective, "Unexpected initial " + 73 "value of property 'hasNeverInlineDirective'"); 74 CompilerToVMHelper.doNotInlineOrCompile(method); 75 hasNeverInlineDirective = CompilerToVMHelper.hasNeverInlineDirective(method); 76 Asserts.assertTrue(hasNeverInlineDirective, aMethod 77 + " : hasNeverInlineDirective is false even after doNotInlineOrCompile'"); 78 } 79 80 private static List<Executable> createTestCases() { 81 List<Executable> testCases = new ArrayList<>(); 82 83 Class<?> aClass = DummyClass.class; 84 testCases.addAll(Arrays.asList(aClass.getDeclaredMethods())); 85 testCases.addAll(Arrays.asList(aClass.getDeclaredConstructors())); 86 return testCases; 87 } 88 } | 54 import java.lang.reflect.Executable; 55 import java.util.ArrayList; 56 import java.util.Arrays; 57 import java.util.List; 58 59 public class DoNotInlineOrCompileTest { 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(DoNotInlineOrCompileTest::runSanityTest); 66 } 67 68 private static void runSanityTest(Executable aMethod) { 69 HotSpotResolvedJavaMethod method = CTVMUtilities 70 .getResolvedMethod(aMethod); 71 boolean hasNeverInlineDirective = CompilerToVMHelper.hasNeverInlineDirective(method); 72 Asserts.assertFalse(hasNeverInlineDirective, "Unexpected initial " + 73 "value of property 'hasNeverInlineDirective'"); 74 CompilerToVMHelper.setNotInlineableOrCompileable(method); 75 hasNeverInlineDirective = CompilerToVMHelper.hasNeverInlineDirective(method); 76 Asserts.assertTrue(hasNeverInlineDirective, aMethod 77 + " : hasNeverInlineDirective is false even after setNotInlineableOrCompileable'"); 78 } 79 80 private static List<Executable> createTestCases() { 81 List<Executable> testCases = new ArrayList<>(); 82 83 Class<?> aClass = DummyClass.class; 84 testCases.addAll(Arrays.asList(aClass.getDeclaredMethods())); 85 testCases.addAll(Arrays.asList(aClass.getDeclaredConstructors())); 86 return testCases; 87 } 88 } |