Interface StoreInstruction
- All Superinterfaces:
ClassFileElement, CodeElement, Instruction
public sealed interface StoreInstruction extends Instruction
Models a local variable store instruction in the where
code array of a Code attribute. Corresponding opcodes have a kind of Opcode.Kind.STORE. Delivered as a CodeElement when traversing the elements of a CodeModel. A local variable store instruction is composite:
StoreInstruction(
TypeKind typeKind,
int slot
)
TypeKind is computational, and slot is u2. astore series of instructions, or reference type store instructions, can also operate on the returnAddress type from discontinued jump subroutine instructions.
- Since:
- 24
- See Also:
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
static StoreInstruction |
of |
Returns a local variable store instruction. |
static StoreInstruction |
of |
Returns a local variable store instruction. |
int |
slot() |
Returns the local variable slot to store to. |
TypeKind |
typeKind() |
Returns the computational type of the value to be stored. |
Methods declared in interface Instruction
opcode, sizeInBytes | Modifier and Type | Method | Description |
|---|---|---|
Opcode |
opcode() |
Returns the operation of this instruction. |
int |
sizeInBytes() |
Returns the size in bytes of this instruction. |
Method Details
slot
int slot()
Returns the local variable slot to store to. It is a
u2 value.- Returns:
- the local variable slot to store to
typeKind
TypeKind typeKind()
Returns the computational type of the value to be stored. The
reference type store instructions also operate on the returnAddress type, which does not apply to reference type load instructions.- Returns:
- the computational type of the value to be stored
of
static StoreInstruction of(TypeKind kind, int slot)
Returns a local variable store instruction.
kind is converted to its computational type. slot must be u2.- Parameters:
-
kind- the type of the value to be stored -
slot- the local variable slot to store to - Returns:
- a local variable store instruction
- Throws:
-
IllegalArgumentException- ifkindisvoidorslotis notu2
of
static StoreInstruction of(Opcode op, int slot)
Returns a local variable store instruction.
The range of slot is restricted by the op and its size:
- API Note:
- The explicit
opargument allows creatingwideor regular store instructions when theslotcan be encoded with more optimized store instructions. - Parameters:
-
op- the opcode for the specific type of store instruction, which must be of kindOpcode.Kind.STORE -
slot- the local variable slot to store to - Returns:
- a local variable store instruction
- Throws:
-
IllegalArgumentException- if the opcode kind is notOpcode.Kind.STOREorslotis out of range
© 1993, 2025, Oracle and/or its affiliates. All rights reserved.
Documentation extracted from Debian's OpenJDK Development Kit package.
Licensed under the GNU General Public License, version 2, with the Classpath Exception.
Various third party code in OpenJDK is licensed under different licenses (see Debian package).
Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.