Interface StoreInstruction
- All Superinterfaces:
ClassFileElement,CodeElement,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 within [0, 65535].
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 TypeMethodDescriptionstatic StoreInstructionReturns a local variable store instruction.static StoreInstructionReturns a local variable store instruction.intslot()Returns the local variable slot to store to.typeKind()Returns the computational type of the value to be stored.Methods declared in interface java.lang.classfile.Instruction
opcode, sizeInBytes
-
Method Details
-
slot
int slot()Returns the local variable slot to store to. The value is within[0, 65535].- Returns:
- the local variable slot to store to
-
typeKind
TypeKind typeKind()Returns the computational type of the value to be stored. Thereferencetype store instructions also operate on thereturnAddresstype, which does not apply toreferencetype load instructions.- Returns:
- the computational type of the value to be stored
-
of
Returns a local variable store instruction.kindis converted to its computational type.slotmust be within[0, 65535].- Parameters:
kind- the type of the value to be storedslot- the local variable slot to store to- Returns:
- a local variable store instruction
- Throws:
IllegalArgumentException- ifkindisvoidorslotis out of range
-
of
Returns a local variable store instruction.The range of
slotis restricted by theopand its size:- If
ophas size 1,slotmust be exactly the slot value implied by the opcode. - If
ophas size 2,slotmust be within[0, 255]. - If
ophas size 4,slotmust be within[0, 65535].
- 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.STOREslot- 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
- If
-