Search in sources :

Example 1 with LazyValue

use of org.graalvm.compiler.phases.common.LazyValue 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);
}
Also used : FixedGuardNode(org.graalvm.compiler.nodes.FixedGuardNode) LazyValue(org.graalvm.compiler.phases.common.LazyValue) LoopsData(org.graalvm.compiler.nodes.loop.LoopsData) DeoptimizeNode(org.graalvm.compiler.nodes.DeoptimizeNode) DebugCloseable(org.graalvm.compiler.debug.DebugCloseable) DeadCodeEliminationPhase(org.graalvm.compiler.phases.common.DeadCodeEliminationPhase)

Aggregations

DebugCloseable (org.graalvm.compiler.debug.DebugCloseable)1 DeoptimizeNode (org.graalvm.compiler.nodes.DeoptimizeNode)1 FixedGuardNode (org.graalvm.compiler.nodes.FixedGuardNode)1 LoopsData (org.graalvm.compiler.nodes.loop.LoopsData)1 DeadCodeEliminationPhase (org.graalvm.compiler.phases.common.DeadCodeEliminationPhase)1 LazyValue (org.graalvm.compiler.phases.common.LazyValue)1