use of org.graalvm.compiler.nodes.loop.DefaultLoopPolicies in project graal by oracle.
the class BoxingEliminationTest method compareGraphs.
private void compareGraphs(final String snippet, final String referenceSnippet, final boolean loopPeeling, final boolean excludeVirtual) {
graph = parseEager(snippet, AllowAssumptions.NO);
HighTierContext context = getDefaultHighTierContext();
CanonicalizerPhase canonicalizer = this.createCanonicalizerPhase();
canonicalizer.apply(graph, context);
createInliningPhase().apply(graph, context);
if (loopPeeling) {
new LoopPeelingPhase(new DefaultLoopPolicies()).apply(graph, context);
}
new DeadCodeEliminationPhase().apply(graph);
canonicalizer.apply(graph, context);
new PartialEscapePhase(false, canonicalizer, graph.getOptions()).apply(graph, context);
new DeadCodeEliminationPhase().apply(graph);
canonicalizer.apply(graph, context);
StructuredGraph referenceGraph = parseEager(referenceSnippet, AllowAssumptions.YES);
createInliningPhase().apply(referenceGraph, context);
new DeadCodeEliminationPhase().apply(referenceGraph);
this.createCanonicalizerPhase().apply(referenceGraph, context);
assertEquals(referenceGraph, graph, excludeVirtual, true);
}
use of org.graalvm.compiler.nodes.loop.DefaultLoopPolicies in project graal by oracle.
the class LockEliminationTest method testUnrolledSync.
@Test
public void testUnrolledSync() {
StructuredGraph graph = getGraph("testUnrolledSyncSnippet", false);
CanonicalizerPhase canonicalizer = createCanonicalizerPhase();
canonicalizer.apply(graph, getProviders());
HighTierContext context = getDefaultHighTierContext();
new LoopFullUnrollPhase(canonicalizer, new DefaultLoopPolicies()).apply(graph, context);
new LockEliminationPhase().apply(graph);
assertDeepEquals(1, graph.getNodes().filter(MonitorEnterNode.class).count());
assertDeepEquals(1, graph.getNodes().filter(MonitorExitNode.class).count());
}
use of org.graalvm.compiler.nodes.loop.DefaultLoopPolicies in project graal by oracle.
the class LoopFullUnrollTest method test.
@SuppressWarnings("try")
private void test(String snippet, int loopCount) {
DebugContext debug = getDebugContext();
try (DebugContext.Scope s = debug.scope(getClass().getSimpleName(), new DebugDumpScope(snippet))) {
final StructuredGraph graph = parseEager(snippet, AllowAssumptions.NO, debug);
CoreProviders context = getProviders();
new LoopFullUnrollPhase(createCanonicalizerPhase(), new DefaultLoopPolicies()).apply(graph, context);
assertTrue(graph.getNodes().filter(LoopBeginNode.class).count() == loopCount);
} catch (Throwable e) {
throw debug.handle(e);
}
}
use of org.graalvm.compiler.nodes.loop.DefaultLoopPolicies in project graal by oracle.
the class EscapeAnalysisTest method testFullyUnrolledLoop.
@Test
public void testFullyUnrolledLoop() {
prepareGraph("testFullyUnrolledLoopSnippet", false);
new LoopFullUnrollPhase(createCanonicalizerPhase(), new DefaultLoopPolicies()).apply(graph, context);
new PartialEscapePhase(false, createCanonicalizerPhase(), graph.getOptions()).apply(graph, context);
Assert.assertEquals(1, returnNodes.size());
Assert.assertTrue(returnNodes.get(0).result() instanceof AllocatedObjectNode);
CommitAllocationNode commit = ((AllocatedObjectNode) returnNodes.get(0).result()).getCommit();
Assert.assertEquals(2, commit.getValues().size());
Assert.assertEquals(1, commit.getVirtualObjects().size());
Assert.assertTrue("non-cyclic data structure expected", commit.getVirtualObjects().get(0) != commit.getValues().get(0));
}
use of org.graalvm.compiler.nodes.loop.DefaultLoopPolicies in project graal by oracle.
the class EscapeAnalysisTest method testPeeledLoop.
@Test
public void testPeeledLoop() {
prepareGraph("testPeeledLoopSnippet", false);
new LoopPeelingPhase(new DefaultLoopPolicies()).apply(graph, getDefaultHighTierContext());
new SchedulePhase(graph.getOptions()).apply(graph, getDefaultHighTierContext());
}
Aggregations