use of org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase in project graal by oracle.
the class NestedLoop_EA method createSuites.
@Override
protected Suites createSuites(OptionValues options) {
Suites suites = super.createSuites(options);
ListIterator<BasePhase<? super HighTierContext>> position = suites.getHighTier().findPhase(PartialEscapePhase.class);
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
// incremental canonicalizer of PEA is missing some important canonicalization (TODO?)
position.add(canonicalizer);
position.add(new PartialEscapePhase(true, canonicalizer, options));
return suites;
}
use of org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase in project graal by oracle.
the class TrufflePEATest method processMethod.
protected StructuredGraph processMethod(final String snippet) {
StructuredGraph graph = parseEager(snippet, StructuredGraph.AllowAssumptions.NO);
HighTierContext context = getDefaultHighTierContext();
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
new PartialEscapePhase(true, true, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
return graph;
}
use of org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase in project graal by oracle.
the class NestedLoopEffectsPhaseComplexityTest method testAndTime.
private void testAndTime(String snippet) {
for (int i = InliningCountLowerBound; i < InliningCountUpperBound; i++) {
StructuredGraph g1 = prepareGraph(snippet, i);
StructuredGraph g2 = (StructuredGraph) g1.copy(g1.getDebug());
ResolvedJavaMethod method = g1.method();
long elapsedRE = runAndTimePhase(g1, new EarlyReadEliminationPhase(new CanonicalizerPhase()));
long elapsedPEA = runAndTimePhase(g2, new PartialEscapePhase(true, new CanonicalizerPhase(), g1.getOptions()));
if (LOG_PHASE_TIMINGS) {
TTY.printf("Needed %dms to run early partial escape analysis on a graph with %d nested loops compiling method %s\n", elapsedPEA, i, method);
}
if (LOG_PHASE_TIMINGS) {
TTY.printf("Needed %dms to run early read elimination on a graph with %d nested loops compiling method %s\n", elapsedRE, i, method);
}
}
}
use of org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase in project graal by oracle.
the class EscapeAnalysisTest method testRemovalSpecialCase.
/**
* Test the case where allocations before and during a loop that have no usages other than their
* phi need to be recognized as an important change. This needs a loop so that the allocation is
* not trivially removed by dead code elimination.
*/
@Test
public void testRemovalSpecialCase() {
prepareGraph("testRemovalSpecialCaseSnippet", false);
Assert.assertEquals(2, graph.getNodes().filter(CommitAllocationNode.class).count());
// create the situation by removing the if
graph.replaceFixedWithFloating(graph.getNodes().filter(LoadFieldNode.class).first(), graph.unique(ConstantNode.forInt(0)));
new CanonicalizerPhase().apply(graph, context);
// verify that an additional run removes all allocations
new PartialEscapePhase(false, false, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
Assert.assertEquals(0, graph.getNodes().filter(CommitAllocationNode.class).count());
}
use of org.graalvm.compiler.virtual.phases.ea.PartialEscapePhase in project graal by oracle.
the class EscapeAnalysisTest method testChangeHandling.
/**
* Tests that a graph with allocations that does not make progress during PEA will not be
* changed.
*/
@Test
public void testChangeHandling() {
prepareGraph("testChangeHandlingSnippet", false);
Assert.assertEquals(2, graph.getNodes().filter(CommitAllocationNode.class).count());
Assert.assertEquals(1, graph.getNodes().filter(BoxNode.class).count());
List<Node> nodes = graph.getNodes().snapshot();
// verify that an additional run doesn't add or remove nodes
new PartialEscapePhase(false, false, new CanonicalizerPhase(), null, graph.getOptions()).apply(graph, context);
Assert.assertEquals(nodes.size(), graph.getNodeCount());
for (Node node : nodes) {
Assert.assertTrue(node.isAlive());
}
}
Aggregations