128.

prev next contents
aload

retrieve object reference from local variable

Jasmin Syntax
     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

After
...
objectref

...
Description

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 stack 
Bytecode

To access to local variables in the range 0-255, use:

Type

Description
u1
aload opcode = 0x19 (25)
u1
<varnum>
There is also a wide format for this instruction, which supports access to all local variables from 0 to 65535:

Type

Description
u1
wide opcode = 0xC4 (196)
u1
aload opcode = 0x19 (25)
u2
<varnum>
See Also

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.


prev next contents
Java Virtual Machine, by Jon Meyer and Troy Downing, O'Reilly Associates


Java Virtual Machine
Java Virtual Machine (Java Series)
ISBN: 1565921941
EAN: 2147483647
Year: 1996
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net