changeset 9440:e35cf6b23b34

Add the condition that was negated in Negatable.negate
author Gilles Duboscq <duboscq@ssw.jku.at>
date Tue, 30 Apr 2013 19:44:02 +0200
parents 8fbd481f3d75
children ee3279c0f9a0
files graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Negatable.java
diffstat 6 files changed, 14 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Tue Apr 30 19:39:49 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java	Tue Apr 30 19:44:02 2013 +0200
@@ -101,7 +101,8 @@
     }
 
     @Override
-    public Negatable negate() {
+    public Negatable negate(LogicNode cond) {
+        assert cond == condition();
         negated = !negated;
         return this;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Tue Apr 30 19:39:49 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java	Tue Apr 30 19:44:02 2013 +0200
@@ -104,7 +104,8 @@
     }
 
     @Override
-    public Negatable negate() {
+    public Negatable negate(LogicNode cond) {
+        assert cond == condition();
         negated = !negated;
         return this;
     }
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Tue Apr 30 19:39:49 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java	Tue Apr 30 19:44:02 2013 +0200
@@ -109,7 +109,8 @@
     }
 
     @Override
-    public Negatable negate() {
+    public Negatable negate(LogicNode cond) {
+        assert cond == condition();
         BeginNode trueSucc = trueSuccessor();
         BeginNode falseSucc = falseSuccessor();
         setTrueSuccessor(null);
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java	Tue Apr 30 19:39:49 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java	Tue Apr 30 19:44:02 2013 +0200
@@ -40,7 +40,7 @@
     public void negateUsages() {
         for (Node n : usages().snapshot()) {
             assert n instanceof Negatable;
-            ((Negatable) n).negate();
+            ((Negatable) n).negate(this);
         }
     }
 
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java	Tue Apr 30 19:39:49 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java	Tue Apr 30 19:44:02 2013 +0200
@@ -94,7 +94,8 @@
     }
 
     @Override
-    public Negatable negate() {
+    public Negatable negate(LogicNode cond) {
+        assert condition() == cond;
         ConditionalNode replacement = graph().unique(new ConditionalNode(condition, falseValue(), trueValue()));
         ((StructuredGraph) graph()).replaceFloating(this, replacement);
         return replacement;
--- a/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Negatable.java	Tue Apr 30 19:39:49 2013 +0200
+++ b/graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Negatable.java	Tue Apr 30 19:44:02 2013 +0200
@@ -28,15 +28,15 @@
  * This interface marks a node as being able to negate its effect, this is intended for nodes that
  * depend on a BooleanNode condition. The canonical representation of has, for example, no way to
  * represent a != b. If such an expression appears during canonicalization the negated expression
- * will be created (a == b) and the usages will be negated, using this interface's {@link #negate()}
- * method.
+ * will be created (a == b) and the usages will be negated, using this interface's
+ * {@link #negate(LogicNode)} method.
  */
 public interface Negatable {
 
     /**
      * Tells this node that a condition it depends has been negated, and that it thus needs to
-     * invert its own effect. For example, an {@link IfNode} would switch its true and false
-     * successors.
+     * invert the effects of this condition. For example, an {@link IfNode} would switch its true
+     * and false successors.
      */
-    Negatable negate();
+    Negatable negate(LogicNode condition);
 }