---
spec: JVMS
title: "The Java Virtual Machine Specification"
edition: "Java SE 20 Edition"
java_version: 20
chapter: "Chapter 6. The Java Virtual Machine Instruction Set"
section: "6.5.ireturn"
heading: "ireturn"
parent: "6.5. Instructions"
source: https://docs.oracle.com/javase/specs/jvms/se20/html/jvms-6.html#jvms-6.5.ireturn
id: "6.5.ireturn"
url: https://jvm.obfuscated.software/jvms/se20/6.5.ireturn.html
raw: https://jvm.obfuscated.software/jvms/se20/6.5.ireturn.md
---

# ireturn

## Operation

Return `int` from method

## Format

```
ireturn
```

## Forms

*ireturn* = 172 (0xac)

## Operand Stack

..., *value* →

[empty]

## Description

The current method must have return type `boolean`, `byte`, `char`, `short`, or `int`. The *value* must be of type `int`. If the current method is a `synchronized` method, the monitor entered or reentered on invocation of the method is updated and possibly exited as if by execution of a *monitorexit* instruction ([§*monitorexit*](6.5.monitorexit.md)) in the current thread. If no exception is thrown, *value* is popped from the operand stack of the current frame ([§2.6](2.6.md)) and pushed onto the operand stack of the frame of the invoker. Any other values on the operand stack of the current method are discarded.

Prior to pushing *value* onto the operand stack of the frame of the invoker, it may have to be converted. If the return type of the invoked method was `byte`, `char`, or `short`, then *value* is converted from `int` to the return type as if by execution of *i2b*, *i2c*, or *i2s*, respectively. If the return type of the invoked method was `boolean`, then *value* is narrowed from `int` to `boolean` by taking the bitwise AND of *value* and 1.

The interpreter then returns control to the invoker of the method, reinstating the frame of the invoker.

## Run-time Exceptions

If the Java Virtual Machine implementation does not enforce the rules on structured locking described in [§2.11.10](2.11.10.md), then if the current method is a `synchronized` method and the current thread is not the owner of the monitor entered or reentered on invocation of the method, *ireturn* throws an `IllegalMonitorStateException`. This can happen, for example, if a `synchronized` method contains a *monitorexit* instruction, but no *monitorenter* instruction, on the object on which the method is synchronized.

Otherwise, if the Java Virtual Machine implementation enforces the rules on structured locking described in [§2.11.10](2.11.10.md) and if the first of those rules is violated during invocation of the current method, then *ireturn* throws an `IllegalMonitorStateException`.
