prev next contents
iload

retrieve integer from local variable

Jasmin Syntax


    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

After
...
int-value

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

For local variable numbers in the range 0-255, use:

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>
See Also

aload, fload, lload, dload, astore, fstore, lstore, dstore, istore


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