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 . |
ILLEGAL
DOUBLE_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, identityEquals
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
add, defaultForKind, forBoolean, forBoxedPrimitive, forByte, forChar, forDouble, forFloat, forIllegal, forInt, forIntegerKind, forLong, forPrimitiveInt, forShort, isNonNull, isNull, mul, one, toString, toValueString, zero
getLIRKind, getPlatformKind, identityEquals
getKind
private 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()
JavaConstant
isNull
in interface JavaConstant
true
if this constant is the null constantpublic boolean isDefaultForKind()
JavaConstant
isDefaultForKind
in interface Constant
isDefaultForKind
in interface JavaConstant
true
if this constant is the default value for its kindpublic boolean asBoolean()
JavaConstant
Kind.Boolean
.asBoolean
in interface JavaConstant
public int asInt()
JavaConstant
Kind.getStackKind()
of Kind.Int
.asInt
in interface JavaConstant
public long asLong()
JavaConstant
Kind.Long
, a Kind.getStackKind()
of Kind.Int
.asLong
in interface JavaConstant
public float asFloat()
JavaConstant
Kind.Float
.asFloat
in interface JavaConstant
public double asDouble()
JavaConstant
Kind.Double
.asDouble
in interface JavaConstant
public Object asBoxedPrimitive()
JavaConstant
asBoxedPrimitive
in interface JavaConstant
public int getSerializedSize()
SerializableConstant
getSerializedSize
in interface SerializableConstant
public void serialize(ByteBuffer buffer)
SerializableConstant
SerializableConstant.getSerializedSize()
bytes available capacity in the buffer.serialize
in interface SerializableConstant
public int hashCode()
hashCode
in class AbstractValue
public boolean equals(Object o)
equals
in class AbstractValue