Mercurial > hg > graal-jvmci-8
diff graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java @ 6708:a5156d39b622
add isDefaultForKind to Constant
author | Lukas Stadler <lukas.stadler@jku.at> |
---|---|
date | Mon, 12 Nov 2012 17:46:21 +0100 |
parents | 2463eb24b644 |
children | fd1c171d9969 |
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java Mon Nov 12 17:45:55 2012 +0100 +++ b/graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/Constant.java Mon Nov 12 17:46:21 2012 +0100 @@ -116,6 +116,15 @@ return getKind().isObject() && object == null; } + /** + * Checks whether this constant is the default value for its kind (null, 0, 0.0, false). + * + * @return {@code true} if this constant is the default value for its kind + */ + public boolean isDefaultForKind() { + return object == null && primitive == 0; + } + @Override public String toString() { return getKind().getJavaName() + "[" + getKind().format(asBoxedValue()) + (getKind() != Kind.Object ? "|0x" + Long.toHexString(primitive) : "") + "]";