aload 0x19
Pushes the reference in local variable (operand).
- Opcode
0x19(25)- Family
- Loads
- Operands
- 1 byte: local variable index
- Length
- 2 bytes
- Operand stack
… → …, value (reference)- Can throw
- nothing at run time (beyond linking errors)
What it does
Pushes the reference in the local variable named by its operand.
Slots 0 to 3 have one-byte forms (aload_0 to aload_3); javac uses this form for slots 4 to 255, and wide for slots above 255.
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 appears 60,166 times in 2,578 of its 7,391 classes: 3.1% of all instructions, the 8th most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.read, java.io.BufferedReader.read, 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 is highlighted.
static int guarded(int[] a, int i) in Switches, compiled by javac 25static int arrays(int n) in Tour, compiled by javac 25Related instructions
astore Pops a reference into local variable (operand).aload_0 Pushes the reference in local variable 0.wide Makes the next instruction take a two-byte local index (and a two-byte iinc constant).
Specification: JVMS §6.5, aload (Java SE 25).