aload_0 or aload_1 or aload_2 or aload_3Stack
Before | After |
... | objectref |
| ... |
aload_<n> represents the series of opcodes aload_0, aload_1, aload_2, and aload_3 that retrieve an object reference held in local variables 0, 1, 2 or 3 and push it onto the stack. <n> must be a valid local variable number in the current frame.
'aload_<n>' is functionally equivalent to 'aload <n>', although it is typically more efficient and also takes fewer bytes in the bytecode.
Example
aload_0 ;push object in local variable 0 aload_1 ;push object in local variable 1 aload_2 ;push object in local variable 2 aload_3 ;push object in local variable 3Bytecode
Type | Description |
u1 | aload_0 opcode = 0x2A (42) |
u1 | aload_1 opcode = 0x2B (43) |
u1 | aload_2 opcode = 0x2C (44) |
u1 | aload_3 opcode = 0x2D (45) |
fload, iload, lload, dload
Notes
If you use astore to store a returnAddress in a local variable, you cannot then use aload_<n> to retrieve the value of that local variable. Instead, if a local variable holds a returnAddress, your only choices are to (1) use ret to return to that address, or (2) use one of the store instructions to store some other value in the local variable.