W3cubDocs

/OpenJDK 25

Interface Instruction

All Superinterfaces:
ClassFileElement, CodeElement
All Known Subinterfaces:
ArrayLoadInstruction, ArrayStoreInstruction, BranchInstruction, ConstantInstruction, ConstantInstruction.ArgumentConstantInstruction, ConstantInstruction.IntrinsicConstantInstruction, ConstantInstruction.LoadConstantInstruction, ConvertInstruction, DiscontinuedInstruction, DiscontinuedInstruction.JsrInstruction, DiscontinuedInstruction.RetInstruction, FieldInstruction, IncrementInstruction, InvokeDynamicInstruction, InvokeInstruction, LoadInstruction, LookupSwitchInstruction, MonitorInstruction, NewMultiArrayInstruction, NewObjectInstruction, NewPrimitiveArrayInstruction, NewReferenceArrayInstruction, NopInstruction, OperatorInstruction, ReturnInstruction, StackInstruction, StoreInstruction, TableSwitchInstruction, ThrowInstruction, TypeCheckInstruction
public sealed interface Instruction extends CodeElement permits ArrayLoadInstruction, ArrayStoreInstruction, BranchInstruction, ConstantInstruction, ConvertInstruction, DiscontinuedInstruction, FieldInstruction, InvokeDynamicInstruction, InvokeInstruction, LoadInstruction, StoreInstruction, IncrementInstruction, LookupSwitchInstruction, MonitorInstruction, NewMultiArrayInstruction, NewObjectInstruction, NewPrimitiveArrayInstruction, NewReferenceArrayInstruction, NopInstruction, OperatorInstruction, ReturnInstruction, StackInstruction, TableSwitchInstruction, ThrowInstruction, TypeCheckInstruction (not exhaustive)
Models an executable instruction in the code array of the Code attribute of a method. The order of instructions in a CodeModel is significant.

The opcode identifies the operation of an instruction. Each kind of opcode has its own modeling interface for instructions.

See Java Virtual Machine Specification:
6.5 Instructions
Sealed Class Hierarchy Graph:
Sealed class hierarchy graph for InstructionSealed class hierarchy graph for Instruction
Since:
24
See Also:

Method Summary

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

opcode

Opcode opcode()
Returns the operation of this instruction.
Returns:
the operation of this instruction

sizeInBytes

int sizeInBytes()
Returns the size in bytes of this instruction. This value is equal to opcode().sizeIfFixed() if it is not -1.
Returns:
the size in bytes of this instruction

© 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.
https://docs.oracle.com/en/java/javase/25/docs/api/java.base/java/lang/classfile/Instruction.html