iload :
retrieve integer from local variable : index : visitVarInsn()
- Description
- Pushes the int value held in a local variable onto the operand stack.
The iload instruction takes a single parameter, <varnum>, an
unsigned integer which indicates which local variable to use. The single-word
int value held in that local variable is retrieved and placed on the stack.
<varnum> must be a valid local variable number in the current method's
frame.
- Example
bipush 5 ; push 5 onto the stack
istore 1 ; pop 5 off of the stack and store in local variable 1
iload 1 ; push the int in local variable 1 (the value 5)
; back onto the stack
- See also
- aload fload lload dload astore fstore lstore dstore istore
- Stack
Before
|
After |
... |
int-value |
|
... |
- Bytecode
Type
|
Description |
u1
|
iload
opcode = 0x15 (21)
|
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
|
iload
opcode = 0x15 (21)
|
u2
|
<varnum> |