code array of a Code attribute, including "intrinsic", "argument", and
"load" constant instructions.
Corresponding opcodes have a kind of Opcode.Kind#CONSTANT . Delivered as a CodeElement when traversing
the elements of a CodeModel.
The loaded constant value is symbolically represented as a ConstantDesc:
ConstantInstruction(ConstantDesc constantValue)
Opcode.Kind#CONSTANT , CodeBuilder::loadConstant
| Modifier and Type | Class and Description |
|---|---|
| public static interface | ConstantInstruction.
Models an "argument constant" instruction, which encodes the constant value in the instruction directly. |
| public static interface | ConstantInstruction.
Models an "intrinsic constant" instruction, which encodes the constant value in its opcode. |
| public static interface | ConstantInstruction.
Models a "load constant" instruction, which encodes the constant value in the constant pool. |
| Modifier and Type | Method and Description |
|---|---|
| public ConstantDesc | |
| public static ConstantInstruction. | Returns: an argument constant instructionthe opcode for the specific type of argument constant instruction,
which must be op, int Opcode#BIPUSH or Opcode#SIPUSHthe constant value value)Returns an argument constant instruction. |
| public static ConstantInstruction. | Returns: an intrinsic constant instructionthe opcode for the specific type of intrinsic constant instruction,
which must be of kind op)Opcode.Returns an intrinsic constant instruction. |
| public static ConstantInstruction. | Returns: a load constant instructionthe opcode for the specific type of load constant instruction,
which must be of kind op, LoadableConstantEntry Opcode.the constant value constant)Returns a load constant instruction. |
| public TypeKind | Returns: the computational type of the constantReturns the computational type of the constant. |
| constantValue | back to summary |
|---|---|
| public ConstantDesc constantValue() Returns the constant value.
| |
| ofArgument | back to summary |
|---|---|
| public static ConstantInstruction. Returns an argument constant instruction.
| |
| ofIntrinsic | back to summary |
|---|---|
| public static ConstantInstruction. Returns an intrinsic constant instruction.
| |
| ofLoad | back to summary |
|---|---|
| public static ConstantInstruction. Returns a load constant instruction.
| |
| typeKind | back to summary |
|---|---|
| public TypeKind typeKind() Returns the computational type of the constant.
This is derived from the
| |
bipush and sipush instructions.
An argument constant instruction is composite:
ArgumentConstantInstruction( Opcode opcode, int constantValue )
opcode must be one of bipush or sipush.
constantValue must be in the range of byte, [-128, 127], for bipush, and in the range of short,
[-32768, 32767], for sipush.
Opcode.Kind#CONSTANT , ConstantInstruction::ofArgument, CodeBuilder::loadConstant(int), CodeBuilder::bipush, CodeBuilder::sipush
| Modifier and Type | Method and Description |
|---|---|
| public Integer | constantValue()
Redeclares java. Returns the constant value. |
| public default TypeKind | typeKind()
Implements java. Returns the computational type of the constant. |
| constantValue | back to summary |
|---|---|
| public Integer constantValue() Redeclares java. Doc from java. Returns the constant value.
| |
| typeKind | back to summary |
|---|---|
| public default TypeKind typeKind() Implements java. Doc from java. Returns the computational type of the constant.
This is derived from the
| |
aconst_null and iconst_0.
An intrinsic constant instruction is composite:
IntrinsicConstantInstruction(Opcode opcode)
opcodeOpcode.Kind#CONSTANT , ConstantInstruction::ofIntrinsic
| Modifier and Type | Method and Description |
|---|---|
| public default TypeKind | typeKind()
Implements java. Returns the computational type of the constant. |
| typeKind | back to summary |
|---|---|
| public default TypeKind typeKind() Implements java. Doc from java. Returns the computational type of the constant.
This is derived from the
| |
ldc and ldc_w, and ldc2_w instructions.
A load constant instruction is composite:
LoadConstantInstruction(LoadableConstantEntry constantEntry)
A "load constant" instruction can load any constant value supported by other constant-load instructions. However, other instructions are usually more optimized, avoiding extra constant pool entries and being smaller.
Opcode.Kind#CONSTANT , ConstantInstruction::ofLoad, CodeBuilder::ldc
| Modifier and Type | Method and Description |
|---|---|
| public LoadableConstantEntry | |
| public default TypeKind | typeKind()
Implements java. Returns the computational type of the constant. |
| constantEntry | back to summary |
|---|---|
| public LoadableConstantEntry constantEntry() Returns the constant value.
| |
| typeKind | back to summary |
|---|---|
| public default TypeKind typeKind() Implements java. Doc from java. Returns the computational type of the constant.
This is derived from the
| |