# HG changeset patch # User Christian Wimmer # Date 1454554437 28800 # Node ID 007614b815d1f5e9f144fd486e6ee7198b1cd45e # Parent 882be1c92a85588815a3aeca5c3abff2ef0dba0c nodeIntrinsicStamp must be its own class diff -r 882be1c92a85 -r 007614b815d1 graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java --- a/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java Wed Feb 03 15:54:08 2016 -0800 +++ b/graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java Wed Feb 03 18:53:57 2016 -0800 @@ -34,6 +34,28 @@ public class StampFactory { + /* + * The marker stamp for node intrinsics must be its own class, so that it is never equal() to a + * regular ObjectStamp. + */ + static final class NodeIntrinsicStamp extends ObjectStamp { + protected static final Stamp SINGLETON = new NodeIntrinsicStamp(); + + private NodeIntrinsicStamp() { + super(null, false, false, false); + } + + @Override + public int hashCode() { + return System.identityHashCode(this); + } + + @Override + public boolean equals(Object obj) { + return this == obj; + } + } + // JaCoCo Exclude private static final Stamp[] stampCache = new Stamp[JavaKind.values().length]; @@ -41,7 +63,6 @@ private static final Stamp objectStamp = new ObjectStamp(null, false, false, false); private static final Stamp objectNonNullStamp = new ObjectStamp(null, false, true, false); private static final Stamp objectAlwaysNullStamp = new ObjectStamp(null, false, false, true); - private static final Stamp nodeIntrinsicStamp = new ObjectStamp(null, false, false, false); private static final Stamp positiveInt = forInteger(JavaKind.Int, 0, Integer.MAX_VALUE, 0, Integer.MAX_VALUE); private static final Stamp booleanTrue = forInteger(JavaKind.Boolean, -1, -1, 1, 1); private static final Stamp booleanFalse = forInteger(JavaKind.Boolean, 0, 0, 0, 0); @@ -117,7 +138,7 @@ * actual stamp when the intrinsic is used, i.e., when the snippet template is instantiated. */ public static Stamp forNodeIntrinsic() { - return nodeIntrinsicStamp; + return NodeIntrinsicStamp.SINGLETON; } public static Stamp intValue() {