aload_<n>

Load object reference from local variable <n>, n=0,1,2,3

Bytecode

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)

Stack ... ==> ..., objectref

Description

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.

The <n> must be a valid index into the local variables of the current frame. The local variable at <n> must contain a reference. The objectref in the local variable at index is pushed onto the operand stack.

Example

aload_0     ;push object in local variable 0

Notes

An aload_<n> instruction cannot be used to load a value of type returnAddress from a local variable onto the operand stack. This asymmetry with the corresponding astore_<n> instruction is intentional. Each of the aload_<n> instructions is the same as aload with an index of <n>, except that the operand <n> is implicit.