areturn 0xb0
Returns the reference on top of the stack from the method.
- Opcode
0xb0(176)- Family
- Returns
- Operands
- none
- Length
- 1 byte
- Operand stack
…, value (reference) → …, (empty: the frame is gone)- Can throw
IllegalMonitorStateException
What it does
Returns the reference 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, areturn appears 32,175 times in 4,844 of its 7,391 classes: 1.6% of all instructions, the 21st most common of 194 opcodes in use. Some of the methods that use it: java.io.BufferedInputStream.getInIfOpen, java.io.BufferedReader.readLine, java.io.BufferedReader$1.next, java.io.ByteArrayInputStream.readAllBytes.
Examples
From the sample classes, compiled by javac 25 with -g. Each Java line is shown above the bytecode it compiled to; areturn is highlighted.
static Runnable hello() in Lambda, compiled by javac 25return () -> System.out.println("hello");private static String hidden() in Nestmates, compiled by javac 25Related instructions
ireturn Returns the int on top of the stack from the method.return Returns from a void method.athrow Throws the exception on top of the stack.
Specification: JVMS §6.5, areturn (Java SE 25).