use of org.graalvm.compiler.virtual.phases.ea.EarlyReadEliminationPhase 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.EarlyReadEliminationPhase in project graal by oracle.
the class EarlyReadEliminationTest method processMethod.
protected StructuredGraph processMethod(String snippet, boolean doLowering) {
StructuredGraph graph = parseEager(getResolvedJavaMethod(snippet), AllowAssumptions.NO);
HighTierContext context = getDefaultHighTierContext();
new InliningPhase(new CanonicalizerPhase()).apply(graph, context);
if (doLowering) {
new LoweringPhase(new CanonicalizerPhase(), LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
}
new EarlyReadEliminationPhase(new CanonicalizerPhase()).apply(graph, context);
return graph;
}
use of org.graalvm.compiler.virtual.phases.ea.EarlyReadEliminationPhase in project graal by oracle.
the class UnsafeReadEliminationTest method testEarlyReadElimination.
public void testEarlyReadElimination(StructuredGraph graph, int reads, int writes) {
PhaseContext context = getDefaultHighTierContext();
CanonicalizerPhase canonicalizer = new CanonicalizerPhase();
canonicalizer.apply(graph, context);
new EarlyReadEliminationPhase(canonicalizer).apply(graph, context);
Assert.assertEquals(3, graph.getNodes().filter(UnsafeAccessNode.class).count());
// after lowering the same applies for reads and writes
new LoweringPhase(canonicalizer, LoweringTool.StandardLoweringStage.HIGH_TIER).apply(graph, context);
canonicalizer.apply(graph, context);
new EarlyReadEliminationPhase(canonicalizer).apply(graph, context);
Assert.assertEquals(reads, graph.getNodes().filter(ReadNode.class).count());
Assert.assertEquals(writes, graph.getNodes().filter(WriteNode.class).count());
}
Aggregations