dconst_1 0x0f

Pushes the double constant 1.

Opcode
0x0f (15)
Family
Constants
Operands
none
Length
1 byte
Operand stack
… → …, 1 (double)
Can throw
nothing at run time (beyond linking errors)
Spec name
dconst_<d>

What it does

Pushes the double 1.0. Only 0 and 1 have one-byte instructions; any other double constant needs ldc2_w of a Double constant.

How often javac uses it

In JDK 25.0.5's java.base module, dconst_1 appears 108 times in 37 of its 7,391 classes: <0.01% of all instructions, the 155th most common of 194 opcodes in use. Some of the methods that use it: java.lang.classfile.CodeBuilder.loadConstant, java.lang.Double.toHexString, java.lang.FdLibm$Acos.compute, java.lang.FdLibm$Asin.compute.

Example

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

static double doubles(double a, double b) in Tour, compiled by javac 25
… 13 instructions before
32x = x / b % 7;
17dstore 4// x
33return -x + 0d + 1d;
19dload 4// x
21dneg
23dadd
25dadd

Open in the viewer

Related instructions

ldc2_w Pushes a long or double constant from the constant pool.

Specification: JVMS §6.5, dconst_<d> (Java SE 25).