Load double
from local variable
Bytecode
For local variable numbers in the range 0-255, use:
Type | Description |
u1 | dload opcode = 0x18 (24) |
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 | dload opcode = 0x18 (24) |
u2 | <varnum> |
Stack
... => ..., value.word1, value.word2
Description
dload retrieves a double-precision floating point number held
in local variable and pushes it onto the operand stack.
Since double-precision floats are 64-bits wide, and each local variable only holds up to 32 bits, Java uses two consecutive local variables, <varnum> and <varnum> + 1 to store a double. So dload <varnum> actually places the values of both <varnum> and <varnum> + 1 onto the operand stack.
Both <varnum> and <varnum> + 1 must be valid local variable numbers in the current frame, and together they must be holding a double.
Remember that attempting to treat two-word values as two independent single-word values will produce a verification error. So trying to retrieve <varnum> or <varnum> + 1 independently (e.g. iload <varnum>) will produce a verification error. Similarly, if you store a non-double value in <varnum>, then <varnum> + 1 becomes invalidated until a new value is stored in it.
The <varnum> is an unsigned byte. Both <varnum> and <varnum> +
1 must be valid indices into the local variables of the current frame. The local variables
at <varnum> and <varnum> + 1 together must contain a double
.
The value of the local variables at <varnum> and <varnum> + 1 is
pushed onto the operand stack.