Load float
from local variable
Bytecode
For local variable numbers in the range 0-255, use:
Type | Description |
u1 | fload opcode = 0x17 (23) |
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 | fload opcode = 0x17 (23) |
u2 | <varnum> |
Pushes the float value held in a local variable onto the operand stack.
The <varnum> is an unsigned byte (short) that must be a valid index into the
local variables of the current frame. The local variable at <varnum> must contain a float
.
The value of the local variable at <varnum> is pushed onto the operand stack.
Example
fconst_2 ; push 2.0 onto the stack fstore 1 ; pop 2.0 off of the stack and store in local variable 1 fload 1 ; push the value from local variable 1 (the value 2.0) ; back onto the stack
The float opcode can be used in conjunction with the wide instruction to access a local variable using a two-byte unsigned index.