< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java

Print this page

        

*** 246,256 **** protected final EconomicMap<MergeNode, EconomicMap<ValuePhiNode, PhiInfoElement>> mergeMaps; /** * Tests which may be eliminated because post dominating tests to prove a broader condition. */ ! private Deque<PendingTest> pendingTests; public Instance(StructuredGraph graph, BlockMap<List<Node>> blockToNodes, PhaseContext context) { this.graph = graph; this.debug = graph.getDebug(); this.blockToNodes = blockToNodes; --- 246,256 ---- protected final EconomicMap<MergeNode, EconomicMap<ValuePhiNode, PhiInfoElement>> mergeMaps; /** * Tests which may be eliminated because post dominating tests to prove a broader condition. */ ! private Deque<DeoptimizingGuard> pendingTests; public Instance(StructuredGraph graph, BlockMap<List<Node>> blockToNodes, PhaseContext context) { this.graph = graph; this.debug = graph.getDebug(); this.blockToNodes = blockToNodes;
*** 553,563 **** } } } } if (guard instanceof DeoptimizingGuard) { ! pendingTests.push(new PendingTest(condition, (DeoptimizingGuard) guard)); } registerCondition(condition, negated, guard); } Pair<InfoElement, Stamp> recursiveFoldStamp(Node node) { --- 553,564 ---- } } } } if (guard instanceof DeoptimizingGuard) { ! assert ((DeoptimizingGuard) guard).getCondition() == condition; ! pendingTests.push((DeoptimizingGuard) guard); } registerCondition(condition, negated, guard); } Pair<InfoElement, Stamp> recursiveFoldStamp(Node node) {
*** 626,644 **** Pair<InfoElement, Stamp> recursiveFoldStampFromInfo(Node node) { return recursiveFoldStamp(node); } protected boolean foldPendingTest(DeoptimizingGuard thisGuard, ValueNode original, Stamp newStamp, GuardRewirer rewireGuardFunction) { ! for (PendingTest pending : pendingTests) { TriState result = TriState.UNKNOWN; ! if (pending.condition instanceof UnaryOpLogicNode) { ! UnaryOpLogicNode unaryLogicNode = (UnaryOpLogicNode) pending.condition; if (unaryLogicNode.getValue() == original) { result = unaryLogicNode.tryFold(newStamp); } ! } else if (pending.condition instanceof BinaryOpLogicNode) { ! BinaryOpLogicNode binaryOpLogicNode = (BinaryOpLogicNode) pending.condition; ValueNode x = binaryOpLogicNode.getX(); ValueNode y = binaryOpLogicNode.getY(); if (x == original) { result = binaryOpLogicNode.tryFold(newStamp, getOtherSafeStamp(y)); } else if (y == original) { --- 627,646 ---- Pair<InfoElement, Stamp> recursiveFoldStampFromInfo(Node node) { return recursiveFoldStamp(node); } protected boolean foldPendingTest(DeoptimizingGuard thisGuard, ValueNode original, Stamp newStamp, GuardRewirer rewireGuardFunction) { ! for (DeoptimizingGuard pendingGuard : pendingTests) { ! LogicNode pendingCondition = pendingGuard.getCondition(); TriState result = TriState.UNKNOWN; ! if (pendingCondition instanceof UnaryOpLogicNode) { ! UnaryOpLogicNode unaryLogicNode = (UnaryOpLogicNode) pendingCondition; if (unaryLogicNode.getValue() == original) { result = unaryLogicNode.tryFold(newStamp); } ! } else if (pendingCondition instanceof BinaryOpLogicNode) { ! BinaryOpLogicNode binaryOpLogicNode = (BinaryOpLogicNode) pendingCondition; ValueNode x = binaryOpLogicNode.getX(); ValueNode y = binaryOpLogicNode.getY(); if (x == original) { result = binaryOpLogicNode.tryFold(newStamp, getOtherSafeStamp(y)); } else if (y == original) {
*** 657,667 **** * be moved up if we're sure there's no schedule dependence. For now limit it to * the original node and constants. */ InputFilter v = new InputFilter(original); thisGuard.getCondition().applyInputs(v); ! if (v.ok && foldGuard(thisGuard, pending.guard, newStamp, rewireGuardFunction)) { return true; } } } return false; --- 659,669 ---- * be moved up if we're sure there's no schedule dependence. For now limit it to * the original node and constants. */ InputFilter v = new InputFilter(original); thisGuard.getCondition().applyInputs(v); ! if (v.ok && foldGuard(thisGuard, pendingGuard, newStamp, rewireGuardFunction)) { return true; } } } return false;
*** 1024,1043 **** * @return whether the transformation could be applied */ boolean rewire(GuardingNode guard, boolean result, Stamp guardedValueStamp, ValueNode newInput); } - protected static class PendingTest { - private final LogicNode condition; - private final DeoptimizingGuard guard; - - public PendingTest(LogicNode condition, DeoptimizingGuard guard) { - this.condition = condition; - this.guard = guard; - } - } - protected static final class InfoElement { private final Stamp stamp; private final GuardingNode guard; private final ValueNode proxifiedInput; private final InfoElement parent; --- 1026,1035 ----
< prev index next >