< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.graph/src/org/graalvm/compiler/graph/Node.java

Print this page




 735         checkReplaceWith(other);
 736         replaceAtMatchingUsages(other, usagePredicate, null);
 737     }
 738 
 739     public void replaceAtUsages(InputType type, Node other) {
 740         checkReplaceWith(other);
 741         for (Node usage : usages().snapshot()) {
 742             for (Position pos : usage.inputPositions()) {
 743                 if (pos.getInputType() == type && pos.get(usage) == this) {
 744                     pos.set(usage, other);
 745                 }
 746             }
 747         }
 748     }
 749 
 750     private void maybeNotifyInputChanged(Node node) {
 751         if (graph != null) {
 752             assert !graph.isFrozen();
 753             NodeEventListener listener = graph.nodeEventListener;
 754             if (listener != null) {
 755                 listener.inputChanged(node);
 756             }
 757         }
 758     }
 759 
 760     public void maybeNotifyZeroUsages(Node node) {
 761         if (graph != null) {
 762             assert !graph.isFrozen();
 763             NodeEventListener listener = graph.nodeEventListener;
 764             if (listener != null && node.isAlive()) {
 765                 listener.usagesDroppedToZero(node);
 766             }
 767         }
 768     }
 769 
 770     public void replaceAtPredecessor(Node other) {
 771         checkReplaceWith(other);
 772         if (predecessor != null) {
 773             if (!predecessor.getNodeClass().replaceFirstSuccessor(predecessor, this, other)) {
 774                 fail("not found in successors, predecessor: %s", predecessor);
 775             }
 776             predecessor.updatePredecessor(this, other);
 777         }
 778     }
 779 
 780     public void replaceAndDelete(Node other) {
 781         checkReplaceWith(other);
 782         if (other == null) {
 783             fail("cannot replace with null");
 784         }
 785         if (this.hasUsages()) {




 735         checkReplaceWith(other);
 736         replaceAtMatchingUsages(other, usagePredicate, null);
 737     }
 738 
 739     public void replaceAtUsages(InputType type, Node other) {
 740         checkReplaceWith(other);
 741         for (Node usage : usages().snapshot()) {
 742             for (Position pos : usage.inputPositions()) {
 743                 if (pos.getInputType() == type && pos.get(usage) == this) {
 744                     pos.set(usage, other);
 745                 }
 746             }
 747         }
 748     }
 749 
 750     private void maybeNotifyInputChanged(Node node) {
 751         if (graph != null) {
 752             assert !graph.isFrozen();
 753             NodeEventListener listener = graph.nodeEventListener;
 754             if (listener != null) {
 755                 listener.event(Graph.NodeEvent.INPUT_CHANGED, node);
 756             }
 757         }
 758     }
 759 
 760     public void maybeNotifyZeroUsages(Node node) {
 761         if (graph != null) {
 762             assert !graph.isFrozen();
 763             NodeEventListener listener = graph.nodeEventListener;
 764             if (listener != null && node.isAlive()) {
 765                 listener.event(Graph.NodeEvent.ZERO_USAGES, node);
 766             }
 767         }
 768     }
 769 
 770     public void replaceAtPredecessor(Node other) {
 771         checkReplaceWith(other);
 772         if (predecessor != null) {
 773             if (!predecessor.getNodeClass().replaceFirstSuccessor(predecessor, this, other)) {
 774                 fail("not found in successors, predecessor: %s", predecessor);
 775             }
 776             predecessor.updatePredecessor(this, other);
 777         }
 778     }
 779 
 780     public void replaceAndDelete(Node other) {
 781         checkReplaceWith(other);
 782         if (other == null) {
 783             fail("cannot replace with null");
 784         }
 785         if (this.hasUsages()) {


< prev index next >