use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class PEAReadEliminationTest method processMethod.
protected StructuredGraph processMethod(final String snippet) {
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
HighTierContext context = getDefaultHighTierContext();
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
new PartialEscapePhase(false, true, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
return graph;
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class PoorMansEATest method test.
@SuppressWarnings("try")
private void test(final String snippet) {
DebugContext debug = getDebugContext();
try (DebugContext.Scope s = debug.scope("PoorMansEATest", new DebugDumpScope(snippet))) {
StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO);
HighTierContext highTierContext = getDefaultHighTierContext();
new InliningPhase(new CanonicalizerPhase()).apply(graph, highTierContext);
PhaseContext context = new PhaseContext(getProviders());
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
// remove framestates in order to trigger the simplification.
cleanup: for (FrameState fs : graph.getNodes(FrameState.TYPE).snapshot()) {
for (Node input : fs.inputs()) {
if (input instanceof NewInstanceNode) {
fs.replaceAtUsages(null);
fs.safeDelete();
continue cleanup;
}
}
}
new CanonicalizerPhase().apply(graph, context);
} catch (Throwable e) {
throw debug.handle(e);
}
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class NestedLoopEffectsPhaseComplexityTest method runAndTimePhase.
private long runAndTimePhase(StructuredGraph g, BasePhase<? super PhaseContext> phase) {
HighTierContext context = getDefaultHighTierContext();
long start = System.currentTimeMillis();
phase.apply(g, context);
long end = System.currentTimeMillis();
DebugContext debug = g.getDebug();
debug.dump(DebugContext.DETAILED_LEVEL, g, "After %s", phase.contractorName());
return end - start;
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class VerifyBailoutUsageTest method testBailoutUsage.
@SuppressWarnings("try")
private static void testBailoutUsage(Class<?> c) {
RuntimeProvider rt = Graal.getRequiredCapability(RuntimeProvider.class);
Providers providers = rt.getHostBackend().getProviders();
MetaAccessProvider metaAccess = providers.getMetaAccess();
PhaseSuite<HighTierContext> graphBuilderSuite = new PhaseSuite<>();
Plugins plugins = new Plugins(new InvocationPlugins());
GraphBuilderConfiguration config = GraphBuilderConfiguration.getDefault(plugins).withEagerResolving(true).withUnresolvedIsError(true);
graphBuilderSuite.appendPhase(new GraphBuilderPhase(config));
HighTierContext context = new HighTierContext(providers, graphBuilderSuite, OptimisticOptimizations.NONE);
OptionValues options = getInitialOptions();
DebugContext debug = DebugContext.create(options, DebugHandlersFactory.LOADER);
for (Method m : c.getDeclaredMethods()) {
if (!Modifier.isNative(m.getModifiers()) && !Modifier.isAbstract(m.getModifiers())) {
ResolvedJavaMethod method = metaAccess.lookupJavaMethod(m);
StructuredGraph graph = new StructuredGraph.Builder(options, debug).method(method).build();
graphBuilderSuite.apply(graph, context);
try (DebugCloseable s = debug.disableIntercept()) {
new VerifyBailoutUsage().apply(graph, context);
}
}
}
}
use of org.graalvm.compiler.phases.tiers.HighTierContext in project graal by oracle.
the class PolymorphicInliningTest method getGraph.
@SuppressWarnings("try")
private StructuredGraph getGraph(final String snippet, final boolean eagerInfopointMode) {
DebugContext debug = getDebugContext();
try (DebugContext.Scope s = debug.scope("InliningTest", new DebugDumpScope(snippet, true))) {
ResolvedJavaMethod method = getResolvedJavaMethod(snippet);
Builder builder = builder(method, AllowAssumptions.YES, debug);
StructuredGraph graph = eagerInfopointMode ? parse(builder, getDebugGraphBuilderSuite()) : parse(builder, getEagerGraphBuilderSuite());
try (DebugContext.Scope s2 = debug.scope("Inlining", graph)) {
PhaseSuite<HighTierContext> graphBuilderSuite = eagerInfopointMode ? getCustomGraphBuilderSuite(GraphBuilderConfiguration.getDefault(getDefaultGraphBuilderPlugins()).withFullInfopoints(true)) : getDefaultGraphBuilderSuite();
HighTierContext context = new HighTierContext(getProviders(), graphBuilderSuite, OptimisticOptimizations.ALL);
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
new CanonicalizerPhase().apply(graph, context);
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
debug.dump(DebugContext.BASIC_LEVEL, graph, "Graph");
new CanonicalizerPhase().apply(graph, context);
new DeadCodeEliminationPhase().apply(graph);
return graph;
}
} catch (Throwable e) {
throw debug.handle(e);
}
}
Aggregations