use of org.graalvm.compiler.nodes.loop.LoopsData in project graal by oracle.
the class SpeculativeGuardMovementPhase method run.
@Override
protected void run(StructuredGraph graph, MidTierContext context) {
try {
if (!graph.getGuardsStage().allowsFloatingGuards()) {
return;
}
LoopsData loops = context.getLoopsDataProvider().getLoopsData(graph);
loops.detectedCountedLoops();
performSpeculativeGuardMovement(context, graph, loops);
} finally {
graph.setAfterStage(StageFlag.GUARD_MOVEMENT);
}
}
use of org.graalvm.compiler.nodes.loop.LoopsData in project graal by oracle.
the class LoopsDataTest method testInnerFirst.
@Test
public void testInnerFirst() {
LoopsData loops = getLoopsData();
Set<LoopEx> seen = new HashSet<>();
for (LoopEx loop : reversed(loops.outerFirst())) {
assertFalse(seen.contains(loop), "%s has already been seen", loop);
if (loop.parent() != null) {
assertFalse(seen.contains(loop.parent()), "%s's parent (%s) should not have already been seen", loop, loop.parent());
}
seen.add(loop);
}
}
use of org.graalvm.compiler.nodes.loop.LoopsData in project graal by oracle.
the class LoopsDataTest method sanityTests.
@Test
public void sanityTests() {
LoopsData loops = getLoopsData();
Assert.assertEquals(8, loops.outerFirst().size());
Assert.assertEquals(1, loops.outerFirst().get(0).loop().getDepth());
Assert.assertEquals(1, loops.outerFirst().get(1).loop().getDepth());
Assert.assertEquals(2, loops.outerFirst().get(2).loop().getDepth());
Assert.assertEquals(3, loops.outerFirst().get(3).loop().getDepth());
Assert.assertEquals(2, loops.outerFirst().get(4).loop().getDepth());
Assert.assertEquals(2, loops.outerFirst().get(5).loop().getDepth());
Assert.assertEquals(3, loops.outerFirst().get(6).loop().getDepth());
Assert.assertEquals(4, loops.outerFirst().get(7).loop().getDepth());
for (LoopEx loop : loops.loops()) {
if (loop.parent() != null) {
Assert.assertEquals(loop.parent().loop().getDepth() + 1, loop.loop().getDepth());
}
}
}
use of org.graalvm.compiler.nodes.loop.LoopsData in project graal by oracle.
the class ConvertDeoptimizeToGuardPhase method run.
@Override
@SuppressWarnings("try")
protected void run(final StructuredGraph graph, final CoreProviders context) {
assert graph.isBeforeStage(StageFlag.VALUE_PROXY_REMOVAL) : "ConvertDeoptimizeToGuardPhase always creates proxies";
assert !graph.getGuardsStage().areFrameStatesAtDeopts() : graph.getGuardsStage();
LazyValue<LoopsData> lazyLoops = new LazyValue<>(() -> context.getLoopsDataProvider().getLoopsData(graph));
for (DeoptimizeNode d : graph.getNodes(DeoptimizeNode.TYPE)) {
assert d.isAlive();
if (d.getAction() == DeoptimizationAction.None) {
continue;
}
try (DebugCloseable closable = d.withNodeSourcePosition()) {
propagateFixed(d, d, context, lazyLoops);
}
}
if (context != null) {
for (FixedGuardNode fixedGuard : graph.getNodes(FixedGuardNode.TYPE)) {
try (DebugCloseable closable = fixedGuard.withNodeSourcePosition()) {
trySplitFixedGuard(fixedGuard, context, lazyLoops);
}
}
}
new DeadCodeEliminationPhase(Optional).apply(graph);
}
use of org.graalvm.compiler.nodes.loop.LoopsData in project graal by oracle.
the class AMD64HotSpotAddressLowering method preProcess.
@Override
public void preProcess(StructuredGraph graph, LoopsDataProvider loopsDataProvider) {
if (graph.hasLoops()) {
LoopsData loopsData = loopsDataProvider.getLoopsData(graph);
loopsData.detectedCountedLoops();
for (LoopEx loop : loopsData.countedLoops()) {
for (OffsetAddressNode offsetAdressNode : loop.whole().nodes().filter(OffsetAddressNode.class)) {
tryOptimize(offsetAdressNode, loop);
}
}
}
}
Aggregations