--- old/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java 2017-11-03 23:57:24.665157346 -0700 +++ new/src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.phases.common/src/org/graalvm/compiler/phases/common/ConditionalEliminationPhase.java 2017-11-03 23:57:24.338142713 -0700 @@ -248,7 +248,7 @@ /** * Tests which may be eliminated because post dominating tests to prove a broader condition. */ - private Deque pendingTests; + private Deque pendingTests; public Instance(StructuredGraph graph, BlockMap> blockToNodes, PhaseContext context) { this.graph = graph; @@ -555,7 +555,8 @@ } } if (guard instanceof DeoptimizingGuard) { - pendingTests.push(new PendingTest(condition, (DeoptimizingGuard) guard)); + assert ((DeoptimizingGuard) guard).getCondition() == condition; + pendingTests.push((DeoptimizingGuard) guard); } registerCondition(condition, negated, guard); } @@ -628,15 +629,16 @@ } protected boolean foldPendingTest(DeoptimizingGuard thisGuard, ValueNode original, Stamp newStamp, GuardRewirer rewireGuardFunction) { - for (PendingTest pending : pendingTests) { + for (DeoptimizingGuard pendingGuard : pendingTests) { + LogicNode pendingCondition = pendingGuard.getCondition(); TriState result = TriState.UNKNOWN; - if (pending.condition instanceof UnaryOpLogicNode) { - UnaryOpLogicNode unaryLogicNode = (UnaryOpLogicNode) pending.condition; + if (pendingCondition instanceof UnaryOpLogicNode) { + UnaryOpLogicNode unaryLogicNode = (UnaryOpLogicNode) pendingCondition; if (unaryLogicNode.getValue() == original) { result = unaryLogicNode.tryFold(newStamp); } - } else if (pending.condition instanceof BinaryOpLogicNode) { - BinaryOpLogicNode binaryOpLogicNode = (BinaryOpLogicNode) pending.condition; + } else if (pendingCondition instanceof BinaryOpLogicNode) { + BinaryOpLogicNode binaryOpLogicNode = (BinaryOpLogicNode) pendingCondition; ValueNode x = binaryOpLogicNode.getX(); ValueNode y = binaryOpLogicNode.getY(); if (x == original) { @@ -659,7 +661,7 @@ */ InputFilter v = new InputFilter(original); thisGuard.getCondition().applyInputs(v); - if (v.ok && foldGuard(thisGuard, pending.guard, newStamp, rewireGuardFunction)) { + if (v.ok && foldGuard(thisGuard, pendingGuard, newStamp, rewireGuardFunction)) { return true; } } @@ -1026,16 +1028,6 @@ 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;