aload_3 0x2d

Pushes the reference in local variable 3.

Opcode
0x2d (45)
Family
Loads
Operands
none
Length
1 byte
Operand stack
… → …, value (reference)
Can throw
nothing at run time (beyond linking errors)
Spec name
aload_<n>

What it does

Pushes the reference in local variable 3.

Slots 0 to 3 each have a one-byte instruction; the general aload takes a one-byte slot number, and wide extends that to two bytes.

The reference may be null; nothing checks it until the reference is used.

How often javac uses it

In JDK 25.0.5's java.base module, aload_3 appears 22,341 times in 2,882 of its 7,391 classes: 1.1% of all instructions, the 25th most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.fill, java.io.BufferedReader.fill, java.io.BufferedWriter.write, java.io.ByteArrayInputStream.transferTo.

Examples

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

static int sum(List values) in Boxing, compiled by javac 25
… 8 instructions before
8for (Integer v : values) {
19invokeinterface #19, 1// Iterator.next() : Object
24checkcast #23// Integer
27astore_3 // v
9total += v;
28iload_1 // total
29aload_3 // v
30invokevirtual #25// Integer.intValue() : int
33iadd
34istore_1 // total
10}
35goto 9
11return total;
38iload_1 // total

Open in the viewer

static int totalLength(List words) in ForEach, compiled by javac 25
… 8 instructions before
15for (String w : words) {
19invokeinterface #19, 1// Iterator.next() : Object
24checkcast #23// String
27astore_3 // w
16total += w.length();
28iload_1 // total
29aload_3 // w
30invokevirtual #25// String.length() : int
33iadd
34istore_1 // total
17}
35goto 9
18return total;
38iload_1 // total

Open in the viewer

Related instructions

astore_3 Pops a reference into local variable 3.aload Pushes the reference in local variable (operand).wide Makes the next instruction take a two-byte local index (and a two-byte iinc constant).

Specification: JVMS §6.5, aload_<n> (Java SE 25).