Top Description Fields Methods
jdk.vm.ci.meta

public Interface JavaConstant

extends Constant, JavaValue
Known Direct Subinterfaces
jdk.vm.ci.hotspot.HotSpotObjectConstant
Known Direct Implementers
jdk.vm.ci.meta.PrimitiveConstant, jdk.vm.ci.hotspot.HotSpotCompressedNullConstant, jdk.vm.ci.meta.NullConstant

Represents a constant (boxed) value, such as an integer, floating point number, or object reference, within the compiler and across the compiler/runtime interface. Exports a set of JavaConstant instances that represent frequently used constant values, such as NULL_POINTER.

Field Summary

Modifier and TypeField and Description
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final PrimitiveConstant
public static final JavaConstant
public static final PrimitiveConstant

Method Summary

Modifier and TypeMethod and Description
public boolean

Returns:

the constant value
asBoolean
()

Returns the primitive boolean value this constant represents.

public Object

Returns:

the value of this constant
asBoxedPrimitive
()

Returns the value of this constant as a boxed Java value.

public double

Returns:

the constant value
asDouble
()

Returns the primitive double value this constant represents.

public float

Returns:

the constant value
asFloat
()

Returns the primitive float value this constant represents.

public int

Returns:

the constant value
asInt
()

Returns the primitive int value this constant represents.

public long

Returns:

the constant value
asLong
()

Returns the primitive long value this constant represents.

public static JavaConstant
defaultForKind(JavaKind kind)

Returns a constant with the default value for the given kind.

public static PrimitiveConstant

Returns:

a boxed copy of value
forBoolean
(boolean
the boolean value to box
i
)

Creates a boxed boolean constant.

public static PrimitiveConstant

Returns:

the primitive constant holding the value
forBoxedPrimitive
(Object
the Java boxed value
value
)

Creates a boxed constant for the given boxed primitive value.

public static PrimitiveConstant

Returns:

a boxed copy of value
forByte
(byte
the byte value to box
i
)

Creates a boxed byte constant.

public static PrimitiveConstant

Returns:

a boxed copy of value
forChar
(char
the char value to box
i
)

Creates a boxed char constant.

public static PrimitiveConstant

Returns:

a boxed copy of value
forDouble
(double
the double value to box
d
)

Creates a boxed double constant.

public static PrimitiveConstant

Returns:

a boxed copy of value
forFloat
(float
the float value to box
f
)

Creates a boxed float constant.

public static PrimitiveConstant
public static PrimitiveConstant

Returns:

a boxed copy of value
forInt
(int
the integer value to box
i
)

Creates a boxed integer constant.

public static PrimitiveConstant
forIntegerKind(JavaKind kind, long i)

Creates a JavaConstant from a primitive integer of a certain kind.

public static PrimitiveConstant

Returns:

a boxed copy of value
forLong
(long
the long value to box
i
)

Creates a boxed long constant.

public static PrimitiveConstant
forPrimitive(char typeChar, long rawValue)

public static PrimitiveConstant
forPrimitive(JavaKind kind, long rawValue)

public static PrimitiveConstant
forPrimitiveInt(int bits, long i)

Creates a JavaConstant from a primitive integer of a certain width.

public static PrimitiveConstant

Returns:

a boxed copy of value
forShort
(short
the short value to box
i
)

Creates a boxed short constant.

public JavaKind
getJavaKind()

Returns the Java kind of this constant.

public boolean

Returns:

true if this constant is the default value for its kind
isDefaultForKind
()

Redeclares jdk.vm.ci.meta.Constant.isDefaultForKind.

Checks whether this constant is the default value for its kind (null, 0, 0.0, false).
public default boolean

Returns:

true if this constant is a primitive, or an object constant that is not null
isNonNull
()

Checks whether this constant is non-null.

public boolean

Returns:

true if this constant is the null constant
isNull
()

Checks whether this constant is null.

public static boolean
public static String
public default String

Field Detail

DOUBLE_0back to summary
public static final PrimitiveConstant DOUBLE_0
DOUBLE_1back to summary
public static final PrimitiveConstant DOUBLE_1
FALSEback to summary
public static final PrimitiveConstant FALSE
FLOAT_0back to summary
public static final PrimitiveConstant FLOAT_0
FLOAT_1back to summary
public static final PrimitiveConstant FLOAT_1
ILLEGALback to summary
public static final PrimitiveConstant ILLEGAL
INT_0back to summary
public static final PrimitiveConstant INT_0
INT_1back to summary
public static final PrimitiveConstant INT_1
INT_2back to summary
public static final PrimitiveConstant INT_2
INT_MINUS_1back to summary
public static final PrimitiveConstant INT_MINUS_1
LONG_0back to summary
public static final PrimitiveConstant LONG_0
LONG_1back to summary
public static final PrimitiveConstant LONG_1
NULL_POINTERback to summary
public static final JavaConstant NULL_POINTER
TRUEback to summary
public static final PrimitiveConstant TRUE

Method Detail

asBooleanback to summary
public boolean asBoolean()

Returns the primitive boolean value this constant represents. The constant must have kind JavaKind#Boolean.

Returns:boolean

the constant value

asBoxedPrimitiveback to summary
public Object asBoxedPrimitive()

Returns the value of this constant as a boxed Java value.

Returns:Object

the value of this constant

asDoubleback to summary
public double asDouble()

Returns the primitive double value this constant represents. The constant must have kind JavaKind#Double.

Returns:double

the constant value

asFloatback to summary
public float asFloat()

Returns the primitive float value this constant represents. The constant must have kind JavaKind#Float.

Returns:float

the constant value

asIntback to summary
public int asInt()

Returns the primitive int value this constant represents. The constant must have a JavaKind#getStackKind() of JavaKind#Int.

Returns:int

the constant value

asLongback to summary
public long asLong()

Returns the primitive long value this constant represents. The constant must have kind JavaKind#Long, a JavaKind#getStackKind() of JavaKind#Int.

Returns:long

the constant value

defaultForKindback to summary
public static JavaConstant defaultForKind(JavaKind kind)

Returns a constant with the default value for the given kind.

forBooleanback to summary
public static PrimitiveConstant forBoolean(boolean i)

Creates a boxed boolean constant.

Parameters
i:boolean

the boolean value to box

Returns:PrimitiveConstant

a boxed copy of value

forBoxedPrimitiveback to summary
public static PrimitiveConstant forBoxedPrimitive(Object value)

Creates a boxed constant for the given boxed primitive value.

Parameters
value:Object

the Java boxed value

Returns:PrimitiveConstant

the primitive constant holding the value

forByteback to summary
public static PrimitiveConstant forByte(byte i)

Creates a boxed byte constant.

Parameters
i:byte

the byte value to box

Returns:PrimitiveConstant

a boxed copy of value

forCharback to summary
public static PrimitiveConstant forChar(char i)

Creates a boxed char constant.

Parameters
i:char

the char value to box

Returns:PrimitiveConstant

a boxed copy of value

forDoubleback to summary
public static PrimitiveConstant forDouble(double d)

Creates a boxed double constant.

Parameters
d:double

the double value to box

Returns:PrimitiveConstant

a boxed copy of value

forFloatback to summary
public static PrimitiveConstant forFloat(float f)

Creates a boxed float constant.

Parameters
f:float

the float value to box

Returns:PrimitiveConstant

a boxed copy of value

forIllegalback to summary
public static PrimitiveConstant forIllegal()
forIntback to summary
public static PrimitiveConstant forInt(int i)

Creates a boxed integer constant.

Parameters
i:int

the integer value to box

Returns:PrimitiveConstant

a boxed copy of value

forIntegerKindback to summary
public static PrimitiveConstant forIntegerKind(JavaKind kind, long i)

Creates a JavaConstant from a primitive integer of a certain kind.

forLongback to summary
public static PrimitiveConstant forLong(long i)

Creates a boxed long constant.

Parameters
i:long

the long value to box

Returns:PrimitiveConstant

a boxed copy of value

forPrimitiveback to summary
public static PrimitiveConstant forPrimitive(char typeChar, long rawValue)
forPrimitiveback to summary
public static PrimitiveConstant forPrimitive(JavaKind kind, long rawValue)
forPrimitiveIntback to summary
public static PrimitiveConstant forPrimitiveInt(int bits, long i)

Creates a JavaConstant from a primitive integer of a certain width.

forShortback to summary
public static PrimitiveConstant forShort(short i)

Creates a boxed short constant.

Parameters
i:short

the short value to box

Returns:PrimitiveConstant

a boxed copy of value

getJavaKindback to summary
public JavaKind getJavaKind()

Returns the Java kind of this constant.

isDefaultForKindback to summary
public boolean isDefaultForKind()

Redeclares jdk.vm.ci.meta.Constant.isDefaultForKind.

Checks whether this constant is the default value for its kind (null, 0, 0.0, false).

Returns:boolean

true if this constant is the default value for its kind

Annotations
@Override
isNonNullback to summary
public default boolean isNonNull()

Checks whether this constant is non-null.

Returns:boolean

true if this constant is a primitive, or an object constant that is not null

isNullback to summary
public boolean isNull()

Checks whether this constant is null.

Returns:boolean

true if this constant is the null constant

isNullback to summary
public static boolean isNull(Constant c)
toStringback to summary
public static String toString(JavaConstant constant)
toValueStringback to summary
public default String toValueString()

Implements jdk.vm.ci.meta.Constant.toValueString.

Annotations
@Override