< prev index next >

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

Print this page




 327         testDebugUsageClass(ValidGraalErrorGuaranteePhase.class);
 328     }
 329 
 330     @Test(expected = VerificationError.class)
 331     public void testGraalCtorInvalid() {
 332         testDebugUsageClass(InvalidGraalErrorCtorPhase.class);
 333     }
 334 
 335     @Test
 336     public void testGraalCtorValid() {
 337         testDebugUsageClass(ValidGraalErrorCtorPhase.class);
 338     }
 339 
 340     @SuppressWarnings("try")
 341     private static void testDebugUsageClass(Class<?> c) {
 342         RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
 343         Providers providers = rt.getHostBackend().getProviders();
 344         MetaAccessProvider metaAccess = providers.getMetaAccess();
 345         PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
 346         Plugins plugins = new Plugins(new InvocationPlugins());
 347         GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true);
 348         graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
 349         HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
 350         OptionValues options = getInitialOptions();
 351         DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
 352         for (Method m : c.getDeclaredMethods()) {
 353             if (!Modifier.isNative(m.getModifiers()) && !Modifier.isAbstract(m.getModifiers())) {
 354                 ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
 355                 StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
 356                 graphBuilderSuite.apply(graph, context);
 357                 try (DebugCloseable s = debug.disableIntercept()) {
 358                     new VerifyDebugUsage().apply(graph, context);
 359                 }
 360             }
 361         }
 362     }
 363 }


 327         testDebugUsageClass(ValidGraalErrorGuaranteePhase.class);
 328     }
 329 
 330     @Test(expected = VerificationError.class)
 331     public void testGraalCtorInvalid() {
 332         testDebugUsageClass(InvalidGraalErrorCtorPhase.class);
 333     }
 334 
 335     @Test
 336     public void testGraalCtorValid() {
 337         testDebugUsageClass(ValidGraalErrorCtorPhase.class);
 338     }
 339 
 340     @SuppressWarnings("try")
 341     private static void testDebugUsageClass(Class<?> c) {
 342         RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
 343         Providers providers = rt.getHostBackend().getProviders();
 344         MetaAccessProvider metaAccess = providers.getMetaAccess();
 345         PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
 346         Plugins plugins = new Plugins(new InvocationPlugins());
 347         GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true).withUnresolvedIsError(true);
 348         graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
 349         HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
 350         OptionValues options = getInitialOptions();
 351         DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
 352         for (Method m : c.getDeclaredMethods()) {
 353             if (!Modifier.isNative(m.getModifiers()) && !Modifier.isAbstract(m.getModifiers())) {
 354                 ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
 355                 StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
 356                 graphBuilderSuite.apply(graph, context);
 357                 try (DebugCloseable s = debug.disableIntercept()) {
 358                     new VerifyDebugUsage().apply(graph, context);
 359                 }
 360             }
 361         }
 362     }
 363 }
< prev index next >