ireturn 0xac

Returns the int on top of the stack from the method.

Opcode
0xac (172)
Family
Returns
Operands
none
Length
1 byte
Operand stack
…, value (int) → …, (empty: the frame is gone)
Can throw
IllegalMonitorStateException

What it does

Returns the int on top of the stack to the caller, which finds it on its own operand stack. Methods returning boolean, byte, char and short use it too.

The IllegalMonitorStateException is for a synchronized method whose monitor is no longer held, which javac never produces.

How often javac uses it

In JDK 25.0.5's java.base module, ireturn appears 17,614 times in 2,979 of its 7,391 classes: 0.90% of all instructions, the 32nd most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.read, java.io.BufferedOutputStream.initialBufferSize, java.io.BufferedReader.read, java.io.BufferedReader$1.hasNext.

Examples

From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; ireturn is highlighted.

int assignField(int v) in Tour, compiled by javac 25
74return count = v;
0aload_0 // this
1iload_1 // v
3putfield #31// Tour.count : int

Open in the viewer

public final int hashCode() in Point, compiled by javac 25
3public record Point(int x, int y) {
0aload_0 // this
1invokedynamic #33// hashCode(Point) : int ⇐ ObjectMethods.bootstrap "x;y"

Open in the viewer

Related instructions

areturn Returns the reference on top of the stack from the method.return Returns from a void method.athrow Throws the exception on top of the stack.

Specification: JVMS §6.5, ireturn (Java SE 25).