diff graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java @ 19141:67d9e635102f

Truffle/Instrumentation: refine checks for safe node replacement
author Michael Van De Vanter <michael.van.de.vanter@oracle.com>
date Tue, 03 Feb 2015 11:48:25 -0800
parents c7e57dffc5ad
children 128586040207
line wrap: on
line diff
--- a/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java	Tue Feb 03 18:30:07 2015 +0100
+++ b/graal/com.oracle.truffle.api/src/com/oracle/truffle/api/nodes/Node.java	Tue Feb 03 11:48:25 2015 -0800
@@ -290,26 +290,10 @@
     }
 
     /**
-     * Checks if this node is properly adopted by its parent.
-     *
-     * @return {@code true} if it is structurally safe to replace this node.
-     */
-    public final boolean isReplaceable() {
-        if (getParent() != null) {
-            for (Node sibling : getParent().getChildren()) {
-                if (sibling == this) {
-                    return true;
-                }
-            }
-        }
-        return false;
-    }
-
-    /**
-     * Checks if this node can be replaced by another node, both structurally and with type safety.
+     * Checks if this node can be replaced by another node: tree structure & type.
      */
     public final boolean isSafelyReplaceableBy(Node newNode) {
-        return isReplaceable() && NodeUtil.isReplacementSafe(getParent(), this, newNode);
+        return NodeUtil.isReplacementSafe(getParent(), this, newNode);
     }
 
     private void reportReplace(Node oldNode, Node newNode, CharSequence reason) {