Interface LoadInstruction
- All Superinterfaces:
ClassFileElement, CodeElement, Instruction
public sealed interface LoadInstruction extends Instruction
Models a local variable load instruction in the where
code array of a Code attribute. Corresponding opcodes have a kind of Opcode.Kind.LOAD. Delivered as a CodeElement when traversing the elements of a CodeModel. A local variable load instruction is composite:
LoadInstruction(
TypeKind typeKind,
int slot
)
TypeKind is computational, and slot is u2.- Since:
- 24
- See Also:
Method Summary
| Modifier and Type | Method | Description |
|---|---|---|
static LoadInstruction |
of |
Returns a local variable load instruction. |
static LoadInstruction |
of |
Returns a local variable load instruction. |
int |
slot() |
Returns the local variable slot to load from. |
TypeKind |
typeKind() |
Returns the computational type of the value to be loaded. |
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 load from. It is a
u2 value.- Returns:
- the local variable slot to load from
typeKind
TypeKind typeKind()
Returns the computational type of the value to be loaded.
- Returns:
- the computational type of the value to be loaded
of
static LoadInstruction of(TypeKind kind, int slot)
Returns a local variable load instruction.
kind is converted to its computational type. slot must be a u2 value.- Parameters:
-
kind- the type of the value to be loaded -
slot- the local variable slot to load from - Returns:
- a local variable load instruction
- Throws:
-
IllegalArgumentException- ifkindisvoidorslotis notu2
of
static LoadInstruction of(Opcode op, int slot)
Returns a local variable load instruction.
The range of slot is restricted by the op and its size:
- API Note:
- The explicit
opargument allows creatingwideor regular load instructions when theslotcan be encoded with more optimized load instructions. - Parameters:
-
op- the opcode for the specific type of load instruction, which must be of kindOpcode.Kind.LOAD -
slot- the local variable slot to load from - Returns:
- a local variable load instruction
- Throws:
-
IllegalArgumentException- if the opcode kind is notOpcode.Kind.LOADorslotis 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.