public class PrimitiveConstant extends AbstractValue implements JavaConstant, SerializableConstant
Value.IllegalValue| Modifier and Type | Field and Description |
|---|---|
private long |
primitive
The boxed primitive value as a
long. |
ILLEGALDOUBLE_0, DOUBLE_1, FALSE, FLOAT_0, FLOAT_1, INT_0, INT_1, INT_2, INT_MINUS_1, LONG_0, LONG_1, NULL_POINTER, TRUE| Modifier | Constructor and Description |
|---|---|
protected |
PrimitiveConstant(Kind kind,
long primitive) |
| Modifier and Type | Method and Description |
|---|---|
boolean |
asBoolean()
Returns the primitive boolean value this constant represents.
|
Object |
asBoxedPrimitive()
Returns the value of this constant as a boxed Java value.
|
double |
asDouble()
Returns the primitive double value this constant represents.
|
float |
asFloat()
Returns the primitive float value this constant represents.
|
int |
asInt()
Returns the primitive int value this constant represents.
|
long |
asLong()
Returns the primitive long value this constant represents.
|
boolean |
equals(Object o) |
int |
getSerializedSize()
Return the size in bytes of the serialized representation of this constant.
|
int |
hashCode() |
boolean |
isDefaultForKind()
Checks whether this constant is the default value for its kind (null, 0, 0.0, false).
|
boolean |
isNull()
Checks whether this constant is null.
|
void |
serialize(ByteBuffer buffer)
Serialize the constant into the ByteBuffer.
|
String |
toString() |
getKind, getKindSuffix, getLIRKind, getPlatformKind, identityEqualsclone, finalize, getClass, notify, notifyAll, wait, wait, waitadd, defaultForKind, forBoolean, forBoxedPrimitive, forByte, forChar, forDouble, forFloat, forIllegal, forInt, forIntegerKind, forLong, forPrimitiveInt, forShort, isNonNull, isNull, mul, one, toString, toValueString, zerogetLIRKind, getPlatformKind, identityEqualsgetKindprivate final long primitive
long. For float and double values,
this value is the result of Float.floatToRawIntBits(float) and
Double.doubleToRawLongBits(double) respectively.protected PrimitiveConstant(Kind kind, long primitive)
public boolean isNull()
JavaConstantisNull in interface JavaConstanttrue if this constant is the null constantpublic boolean isDefaultForKind()
JavaConstantisDefaultForKind in interface ConstantisDefaultForKind in interface JavaConstanttrue if this constant is the default value for its kindpublic boolean asBoolean()
JavaConstantKind.Boolean.asBoolean in interface JavaConstantpublic int asInt()
JavaConstantKind.getStackKind() of Kind.Int.asInt in interface JavaConstantpublic long asLong()
JavaConstantKind.Long, a Kind.getStackKind() of Kind.Int.asLong in interface JavaConstantpublic float asFloat()
JavaConstantKind.Float.asFloat in interface JavaConstantpublic double asDouble()
JavaConstantKind.Double.asDouble in interface JavaConstantpublic Object asBoxedPrimitive()
JavaConstantasBoxedPrimitive in interface JavaConstantpublic int getSerializedSize()
SerializableConstantgetSerializedSize in interface SerializableConstantpublic void serialize(ByteBuffer buffer)
SerializableConstantSerializableConstant.getSerializedSize() bytes available capacity in the buffer.serialize in interface SerializableConstantpublic int hashCode()
hashCode in class AbstractValuepublic boolean equals(Object o)
equals in class AbstractValue