dreturn 0xaf

Returns the double on top of the stack from the method.

Opcode
0xaf (175)
Family
Returns
Operands
none
Length
1 byte
Operand stack
…, value (double) → …, (empty: the frame is gone)
Can throw
IllegalMonitorStateException

What it does

Returns the double on top of the stack to the caller, which finds it on its own operand stack.

The IllegalMonitorStateException is for a synchronized method whose monitor is no longer held, which javac never produces.

How often javac uses it

In JDK 25.0.5's java.base module, dreturn appears 608 times in 112 of its 7,391 classes: 0.03% of all instructions, the 118th most common of 194 opcodes in use. Some of the methods that use it: java.io.DataInputStream.readDouble, java.io.ObjectInputStream.readDouble, java.io.ObjectInputStream$BlockDataInputStream.readDouble, java.io.ObjectInputStream$FieldValues.get.

Examples

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

public double r() in Shapes.Circle, compiled by javac 25
3record Circle(double r) implements Shape {}
0aload_0 // this
1getfield #7// Shapes$Circle.r : double

Open in the viewer

public double w() in Shapes.Rect, compiled by javac 25
5record Rect(double w, double h) implements Shape {}
0aload_0 // this
1getfield #7// Shapes$Rect.w : double

Open in the viewer

Related instructions

ireturn Returns the int on top of the stack from the method.areturn Returns the reference on top of the stack from the method.return Returns from a void method.

Specification: JVMS §6.5, dreturn (Java SE 25).