< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.nodes/src/org/graalvm/compiler/nodes/AbstractFixedGuardNode.java

Print this page




 109         if (verbosity == Verbosity.Name && negated) {
 110             return "!" + super.toString(verbosity);
 111         } else {
 112             return super.toString(verbosity);
 113         }
 114     }
 115 
 116     @Override
 117     public void simplify(SimplifierTool tool) {
 118         while (condition instanceof LogicNegationNode) {
 119             LogicNegationNode negation = (LogicNegationNode) condition;
 120             setCondition(negation.getValue(), !negated);
 121         }
 122     }
 123 
 124     @SuppressWarnings("try")
 125     public DeoptimizeNode lowerToIf() {
 126         try (DebugCloseable position = this.withNodeSourcePosition()) {
 127             FixedNode currentNext = next();
 128             setNext(null);








 129             DeoptimizeNode deopt = graph().add(new DeoptimizeNode(action, reason, speculation));
 130             deopt.setStateBefore(stateBefore());
 131             IfNode ifNode;
 132             AbstractBeginNode noDeoptSuccessor;
 133             if (negated) {
 134                 ifNode = graph().add(new IfNode(condition, deopt, currentNext, 0));
 135                 noDeoptSuccessor = ifNode.falseSuccessor();
 136             } else {
 137                 ifNode = graph().add(new IfNode(condition, currentNext, deopt, 1));
 138                 noDeoptSuccessor = ifNode.trueSuccessor();
 139             }
 140             noDeoptSuccessor.setNodeSourcePosition(getNoDeoptSuccessorPosition());
 141             ((FixedWithNextNode) predecessor()).setNext(ifNode);
 142             this.replaceAtUsages(noDeoptSuccessor);
 143             GraphUtil.killWithUnusedFloatingInputs(this);
 144 
 145             return deopt;
 146         }
 147     }
 148 




 109         if (verbosity == Verbosity.Name && negated) {
 110             return "!" + super.toString(verbosity);
 111         } else {
 112             return super.toString(verbosity);
 113         }
 114     }
 115 
 116     @Override
 117     public void simplify(SimplifierTool tool) {
 118         while (condition instanceof LogicNegationNode) {
 119             LogicNegationNode negation = (LogicNegationNode) condition;
 120             setCondition(negation.getValue(), !negated);
 121         }
 122     }
 123 
 124     @SuppressWarnings("try")
 125     public DeoptimizeNode lowerToIf() {
 126         try (DebugCloseable position = this.withNodeSourcePosition()) {
 127             FixedNode currentNext = next();
 128             setNext(null);
 129             if (currentNext instanceof AbstractBeginNode && currentNext instanceof StateSplit && ((StateSplit) currentNext).stateAfter() != null) {
 130                 // Force an extra BeginNode in case any guarded Nodes are inputs to the StateSplit
 131                 BeginNode begin = graph().add(new BeginNode());
 132                 begin.setNodeSourcePosition(getNoDeoptSuccessorPosition());
 133                 begin.setNext(currentNext);
 134                 currentNext = begin;
 135             }
 136 
 137             DeoptimizeNode deopt = graph().add(new DeoptimizeNode(action, reason, speculation));
 138             deopt.setStateBefore(stateBefore());
 139             IfNode ifNode;
 140             AbstractBeginNode noDeoptSuccessor;
 141             if (negated) {
 142                 ifNode = graph().add(new IfNode(condition, deopt, currentNext, 0));
 143                 noDeoptSuccessor = ifNode.falseSuccessor();
 144             } else {
 145                 ifNode = graph().add(new IfNode(condition, currentNext, deopt, 1));
 146                 noDeoptSuccessor = ifNode.trueSuccessor();
 147             }
 148             noDeoptSuccessor.setNodeSourcePosition(getNoDeoptSuccessorPosition());
 149             ((FixedWithNextNode) predecessor()).setNext(ifNode);
 150             this.replaceAtUsages(noDeoptSuccessor);
 151             GraphUtil.killWithUnusedFloatingInputs(this);
 152 
 153             return deopt;
 154         }
 155     }
 156 


< prev index next >