< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.core.test/src/org/graalvm/compiler/core/test/VerifyBailoutUsageTest.java

Print this page




 106         testBailoutUsage(InvalidBailoutUsagePhase3.class);
 107     }
 108 
 109     @Test
 110     public void testValidPermanentBailout() {
 111         testBailoutUsage(ValidPermanentBailoutUsage.class);
 112     }
 113 
 114     @Test
 115     public void testValidRetryableBailout() {
 116         testBailoutUsage(ValidRetryableBailoutUsage.class);
 117     }
 118 
 119     @SuppressWarnings("try")
 120     private static void testBailoutUsage(Class<?> c) {
 121         RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
 122         Providers providers = rt.getHostBackend().getProviders();
 123         MetaAccessProvider metaAccess = providers.getMetaAccess();
 124         PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
 125         Plugins plugins = new Plugins(new InvocationPlugins());
 126         GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true);
 127         graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
 128         HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
 129         OptionValues options = getInitialOptions();
 130         DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
 131         for (Method m : c.getDeclaredMethods()) {
 132             if (!Modifier.isNative(m.getModifiers()) && !Modifier.isAbstract(m.getModifiers())) {
 133                 ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
 134                 StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
 135                 graphBuilderSuite.apply(graph, context);
 136                 try (DebugCloseable s = debug.disableIntercept()) {
 137                     new VerifyBailoutUsage().apply(graph, context);
 138                 }
 139             }
 140         }
 141     }
 142 }


 106         testBailoutUsage(InvalidBailoutUsagePhase3.class);
 107     }
 108 
 109     @Test
 110     public void testValidPermanentBailout() {
 111         testBailoutUsage(ValidPermanentBailoutUsage.class);
 112     }
 113 
 114     @Test
 115     public void testValidRetryableBailout() {
 116         testBailoutUsage(ValidRetryableBailoutUsage.class);
 117     }
 118 
 119     @SuppressWarnings("try")
 120     private static void testBailoutUsage(Class<?> c) {
 121         RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
 122         Providers providers = rt.getHostBackend().getProviders();
 123         MetaAccessProvider metaAccess = providers.getMetaAccess();
 124         PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
 125         Plugins plugins = new Plugins(new InvocationPlugins());
 126         GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true).withUnresolvedIsError(true);
 127         graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
 128         HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
 129         OptionValues options = getInitialOptions();
 130         DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
 131         for (Method m : c.getDeclaredMethods()) {
 132             if (!Modifier.isNative(m.getModifiers()) && !Modifier.isAbstract(m.getModifiers())) {
 133                 ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
 134                 StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
 135                 graphBuilderSuite.apply(graph, context);
 136                 try (DebugCloseable s = debug.disableIntercept()) {
 137                     new VerifyBailoutUsage().apply(graph, context);
 138                 }
 139             }
 140         }
 141     }
 142 }
< prev index next >