< prev index next >

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

Print this page




  65         @SuppressWarnings({"static-method", "unused"})
  66         public Object test() {
  67             return CONST;
  68         }
  69     }
  70 
  71     @Test
  72     public void test() {
  73         eagerlyParseMethod(C.class, "test");
  74 
  75     }
  76 
  77     @SuppressWarnings("try")
  78     private void eagerlyParseMethod(Class<C> clazz, String methodName) {
  79         RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
  80         Providers providers = rt.getHostBackend().getProviders();
  81         MetaAccessProvider metaAccess = providers.getMetaAccess();
  82 
  83         PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
  84         Plugins plugins = new Plugins(new InvocationPlugins());
  85         GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true);
  86         graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
  87         HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
  88 
  89         Assume.assumeTrue(VerifyPhase.class.desiredAssertionStatus());
  90 
  91         final Method m = getMethod(clazz, methodName);
  92         ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
  93         OptionValues options = getInitialOptions();
  94         DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
  95         StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
  96         try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("GraphBuilding", graph, method)) {
  97             graphBuilderSuite.apply(graph, context);
  98         } catch (Throwable e) {
  99             throw debug.handle(e);
 100         }
 101     }
 102 }


  65         @SuppressWarnings({"static-method", "unused"})
  66         public Object test() {
  67             return CONST;
  68         }
  69     }
  70 
  71     @Test
  72     public void test() {
  73         eagerlyParseMethod(C.class, "test");
  74 
  75     }
  76 
  77     @SuppressWarnings("try")
  78     private void eagerlyParseMethod(Class<C> clazz, String methodName) {
  79         RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
  80         Providers providers = rt.getHostBackend().getProviders();
  81         MetaAccessProvider metaAccess = providers.getMetaAccess();
  82 
  83         PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
  84         Plugins plugins = new Plugins(new InvocationPlugins());
  85         GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true).withUnresolvedIsError(true);
  86         graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
  87         HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
  88 
  89         Assume.assumeTrue(VerifyPhase.class.desiredAssertionStatus());
  90 
  91         final Method m = getMethod(clazz, methodName);
  92         ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
  93         OptionValues options = getInitialOptions();
  94         DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
  95         StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
  96         try (DebugCloseable s = debug.disableIntercept(); DebugContext.Scope ds = debug.scope("GraphBuilding", graph, method)) {
  97             graphBuilderSuite.apply(graph, context);
  98         } catch (Throwable e) {
  99             throw debug.handle(e);
 100         }
 101     }
 102 }
< prev index next >