Skip to content

Mnemonics on Instructions

Peyang edited this page Jul 21, 2025 · 2 revisions

Mnemonics on Instructions

JVM instructions follow a very intuitive naming convention.

このページは日本語でもご覧いただけます。


Instruction names are usually composed in the form of noun-verb. For example, iload means i (integer type) and load (to load), so it is an instruction that loads an integer value onto the stack.

List of Prefixes (Nouns)

The i in iload is a prefix representing the integer type. In the JVM, various prefixes are provided to represent types and operations.

Prefix Description
b Represents 8-bit integer (byte) type.
c Represents 16-bit character (char) type.
s Represents 16-bit integer (short) type.
i Represents 32-bit integer (int) type.
l Represents 64-bit integer (long) type.
f Represents 32-bit floating point (float) type.
d Represents 64-bit floating point (double) type.
a Represents object reference (Object) type.
a* Represents array type.
monitor Represents an object's monitor.
static Represents static fields or methods.
field Represents a field.

Note

a is a prefix representing an object reference, but by adding a after a type prefix, it represents an array type. For example, iaload is an instruction that loads a value from an integer array, and aaload loads a value from an object array.

List of Verbs

The load in iload is a verb representing the action of loading a value onto the stack. The JVM provides the following verbs:

Verb Description
const Pushes a constant onto the stack.
load Loads a value from the local variable table onto the stack.
store Stores a value from the stack into the local variable table.
add Adds two values on the stack.
sub Subtracts two values on the stack.
mul Multiplies two values on the stack.
div Divides two values on the stack.
rem Computes the remainder of two values on the stack.
neg Negates the value on the stack.
and Computes the logical AND of two values on the stack.
or Computes the logical OR of two values on the stack.
xor Computes the logical XOR of two values on the stack.
shl Left-shifts the value on the stack.
shr Right-shifts the value on the stack.
ushr Unsigned right-shifts the value on the stack.
inc Increments the value of a local variable.
if* Performs conditional branching.
newarray Creates a new array and pushes it onto the stack.
put Sets a value to a field.
get Loads a field's value onto the stack.
invoke Invokes a method.
return Returns from a method.
throw Throws an exception.
switch Branches based on the value on the stack.

Note

if is a verb for conditional branching, but specific branch instructions have other verbs attached, such as if_icmpeq or if_acmpeq. Alternatively, instructions like ifeq or ifne have suffixes indicating the condition.

Verbs for Comparison (Suffixes)

Verb Description
cmp Compares two values on the stack and pushes the result, or simply compares.
eq Compares if two values on the stack are equal.
ne Compares if two values on the stack are not equal.
lt, l Compares if the first value is less than the second.
gt, g Compares if the first value is greater than the second.
le Compares if the first value is less than or equal to the second.
ge Compares if the first value is greater than or equal to the second.

Note

For example, if_acmpeq can be decomposed as if (conditional branch), a (object), cmp (compare), and eq (equal).

List of Suffixes

For example, jsr_w is jsr (jump to subroutine) with the suffix w (wide instruction). The JVM provides the following suffixes:

Suffix Description
w Represents a wide instruction. Handles large operands not possible with normal instructions.

Abbreviations & Other Terms

x2x

x2x is a prefix for instructions that convert the value on the stack to another type. For example, i2l converts an int value to a long, and f2d converts a float value to a double.

Here, 2 stands for the English "to", so i2l means "int-to-long".

jsr

jsr is a prefix for instructions that call a subroutine (method).

It stands for "Jump to SubRoutine", and jumps to the start of a subroutine, pushing the return address onto the stack.

ret

ret is a prefix for instructions that return from a subroutine.

It stands for "Return from SubRoutine", pops the return address from the stack, and jumps to that location.

Clone this wiki locally