# HG changeset patch # User Gilles Duboscq # Date 1367343842 -7200 # Node ID e35cf6b23b3423026df7201d8d7b485f4dd8016e # Parent 8fbd481f3d7515f030ba7a951414ec5c74b79947 Add the condition that was negated in Negatable.negate diff -r 8fbd481f3d75 -r e35cf6b23b34 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/FixedGuardNode.java --- 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; } diff -r 8fbd481f3d75 -r e35cf6b23b34 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/GuardNode.java --- 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; } diff -r 8fbd481f3d75 -r e35cf6b23b34 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/IfNode.java --- 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); diff -r 8fbd481f3d75 -r e35cf6b23b34 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/LogicNode.java --- 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); } } diff -r 8fbd481f3d75 -r e35cf6b23b34 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/calc/ConditionalNode.java --- 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; diff -r 8fbd481f3d75 -r e35cf6b23b34 graal/com.oracle.graal.nodes/src/com/oracle/graal/nodes/spi/Negatable.java --- 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); }