dload_2 0x28

Pushes the double in local variable 2.

Opcode
0x28 (40)
Family
Loads
Operands
none
Length
1 byte
Operand stack
… → …, value (double)
Can throw
nothing at run time (beyond linking errors)
Spec name
dload_<n>

What it does

Pushes the double in local variable 2. It is a long or double, so it takes two slots: local variables n and n+1, and two stack slots.

Slots 0 to 3 each have a one-byte instruction; the general dload takes a one-byte slot number, and wide extends that to two bytes.

How often javac uses it

In JDK 25.0.5's java.base module, dload_2 appears 358 times in 73 of its 7,391 classes: 0.02% of all instructions, the 129th most common of 194 opcodes in use. Some of the methods that use it: java.io.ObjectInputStream$FieldValues.get, java.io.ObjectOutputStream$PutFieldImpl.put, java.lang.AbstractStringBuilder.insert, java.lang.Double.compare.

Examples

From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; dload_2 is highlighted.

static boolean doubleGreater(double a, double b) in Compare, compiled by javac 25
12return a > b;
0dload_0 // a
1dload_2 // b

Open in the viewer

static double doubles(double a, double b) in Tour, compiled by javac 25
31double x = a + b - a * b;
0dload_0 // a
1dload_2 // b
3dload_0 // a
4dload_2 // b
7dstore 4// x
… 13 instructions after

Open in the viewer

Related instructions

dstore_2 Pops a double into local variable 2.dload Pushes the double in local variable (operand).wide Makes the next instruction take a two-byte local index (and a two-byte iinc constant).

Specification: JVMS §6.5, dload_<n> (Java SE 25).