Mercurial > hg > graal-compiler
changeset 23372:007614b815d1
nodeIntrinsicStamp must be its own class
author | Christian Wimmer <christian.wimmer@oracle.com> |
---|---|
date | Wed, 03 Feb 2016 18:53:57 -0800 |
parents | 882be1c92a85 |
children | 5e5fdf05b14e |
files | graal/com.oracle.graal.compiler.common/src/com/oracle/graal/compiler/common/type/StampFactory.java |
diffstat | 1 files changed, 23 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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() {