astore_0
or
astore_1
or
astore_2
or
astore_3
Stack
Before
|
After
|
| objectref
|
...
|
| ...
|
Pops objectref (a reference to an object or array) off the stack and stores it in local variable <n>, where <n> is 0, 1, 2 or 3. <n> must be a valid local variable number in the current frame.
'astore_<n>' is functionally equivalent to 'astore <n>', although it is typically more efficient and also takes fewer bytes in the bytecode.
Example
astore_0 ; store reference in local variable 0 astore_1 ; store reference in local variable 1 astore_2 ; store reference in local variable 2 astore_3 ; store reference in local variable 3Bytecode
Type
|
Description
|
|
u1
|
astore_0
opcode = 0x4B (75)
|
|
u1
|
astore_1
opcode = 0x4C (76)
|
|
u1
|
astore_2
opcode = 0x4D (77)
|
|
u1
|
astore_3
opcode = 0x4E (78)
|
astore, istore, fstore, dstore, lstore, aload, iload, fload, dload, lload
Notes
astore can also be used to store a returnAddress in a local variable. See the jsr instruction for more details.