iload <varnum>
or
wide
iload <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 0xFFFE.
Stack
Before
Description
After
...
int-value
...
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
BytecodeFor local variable numbers in the range 0-255, use:
Type
|
Description
|
|
u1
|
iload
opcode = 0x15 (21)
|
|
u1
|
<varnum>
|
Type
|
Description
|
| u1
|
wide
opcode = 0xC4 (196)
|
|
u1
|
iload
opcode = 0x15 (21)
|
|
u2
|
<varnum>
|
aload, fload, lload, dload, astore, fstore, lstore, dstore, istore