aload <varnum>
or
wide
aload <varnum>
In
the first form, <varnum> is an unsigned integer in the range 0 to 0xFF.
In the second (wide) form, <varnum> is an unsigned integer in the range 0
to 0xFFFF.
Stack
Before
Description
After
...
objectref
...
Retrieves an object reference from a local variable and pushes it onto the operand stack. The aload instruction takes a single parameter, <varnum>, an unsigned integer which indicates which local variable to retrieve. The object reference in that local variable is retrieved and placed on the stack. <varnum> must be a valid local variable number in the current frame.
Example
aload 1 ; push object reference in local variable 1 onto the stackBytecode
To access to local variables in the range 0-255, use:
Type
|
Description
|
|
u1
|
aload
opcode = 0x19 (25)
|
|
u1
|
<varnum>
|
Type
|
Description
|
| u1
|
wide
opcode = 0xC4 (196)
|
| u1
|
aload
opcode = 0x19 (25)
|
| u2
|
<varnum>
|
fload, iload, lload, dload, wide
Notes
If you use astore to store a returnAddress in a local variable, you cannot then use aload 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.