< prev index next >

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

Print this page




1232     }
1233 
1234     @SuppressWarnings("try")
1235     protected StructuredGraph parse(StructuredGraph.Builder builder, PhaseSuite<HighTierContext> graphBuilderSuite) {
1236         ResolvedJavaMethod javaMethod = builder.getMethod();
1237         if (builder.getCancellable() == null) {
1238             builder.cancellable(getCancellable(javaMethod));
1239         }
1240         assert javaMethod.getAnnotation(Test.class) == null : "shouldn't parse method with @Test annotation: " + javaMethod;
1241         StructuredGraph graph = builder.build();
1242         DebugContext debug = graph.getDebug();
1243         try (DebugContext.Scope ds = debug.scope("Parsing", javaMethod, graph)) {
1244             graphBuilderSuite.apply(graph, getDefaultHighTierContext());
1245             return graph;
1246         } catch (Throwable e) {
1247             throw debug.handle(e);
1248         }
1249     }
1250 
1251     protected PhaseSuite<HighTierContext> getEagerGraphBuilderSuite() {
1252         return getCustomGraphBuilderSuite(GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withEagerResolving(true));
1253     }
1254 
1255     /**
1256      * Gets the cancellable that should be associated with a graph being created by any of the
1257      * {@code parse...()} methods.
1258      *
1259      * @param method the method being parsed into a graph
1260      */
1261     protected Cancellable getCancellable(ResolvedJavaMethod method) {
1262         return null;
1263     }
1264 
1265     protected Plugins getDefaultGraphBuilderPlugins() {
1266         PhaseSuite<HighTierContext> suite = backend.getSuites().getDefaultGraphBuilderSuite();
1267         Plugins defaultPlugins = ((GraphBuilderPhase) suite.findPhase(GraphBuilderPhase.class).previous()).getGraphBuilderConfig().getPlugins();
1268         // defensive copying
1269         return new Plugins(defaultPlugins);
1270     }
1271 
1272     protected PhaseSuite<HighTierContext> getDefaultGraphBuilderSuite() {




1232     }
1233 
1234     @SuppressWarnings("try")
1235     protected StructuredGraph parse(StructuredGraph.Builder builder, PhaseSuite<HighTierContext> graphBuilderSuite) {
1236         ResolvedJavaMethod javaMethod = builder.getMethod();
1237         if (builder.getCancellable() == null) {
1238             builder.cancellable(getCancellable(javaMethod));
1239         }
1240         assert javaMethod.getAnnotation(Test.class) == null : "shouldn't parse method with @Test annotation: " + javaMethod;
1241         StructuredGraph graph = builder.build();
1242         DebugContext debug = graph.getDebug();
1243         try (DebugContext.Scope ds = debug.scope("Parsing", javaMethod, graph)) {
1244             graphBuilderSuite.apply(graph, getDefaultHighTierContext());
1245             return graph;
1246         } catch (Throwable e) {
1247             throw debug.handle(e);
1248         }
1249     }
1250 
1251     protected PhaseSuite<HighTierContext> getEagerGraphBuilderSuite() {
1252         return getCustomGraphBuilderSuite(GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withEagerResolving(true).withUnresolvedIsError(true));
1253     }
1254 
1255     /**
1256      * Gets the cancellable that should be associated with a graph being created by any of the
1257      * {@code parse...()} methods.
1258      *
1259      * @param method the method being parsed into a graph
1260      */
1261     protected Cancellable getCancellable(ResolvedJavaMethod method) {
1262         return null;
1263     }
1264 
1265     protected Plugins getDefaultGraphBuilderPlugins() {
1266         PhaseSuite<HighTierContext> suite = backend.getSuites().getDefaultGraphBuilderSuite();
1267         Plugins defaultPlugins = ((GraphBuilderPhase) suite.findPhase(GraphBuilderPhase.class).previous()).getGraphBuilderConfig().getPlugins();
1268         // defensive copying
1269         return new Plugins(defaultPlugins);
1270     }
1271 
1272     protected PhaseSuite<HighTierContext> getDefaultGraphBuilderSuite() {


< prev index next >