# return-object

## Purpose

Return from an object-returning method.

## Details

Op & Format | Mnemonic / Syntax | Arguments
--- | --- | ---
11 11x | return-object vAA | `A:` return value register (8 bits)

## Constraints

- The return type of the current method must be a reference.
- A must be a valid register index in the current stack frame.
- Register vA must be known to be reference-bearing.

## Behavior

- If the method is synchronized, the object's monitor is released in a way similar to the monitor-exit instruction.
- The stack frame of the current method invocation is removed from the stack. This includes all its registers becoming invalid.
- If the stack is now empty, the current thread terminates.
- Otherwise, the following happens:

- The stack frame that caused this method invocation becomes valid. This includes all its registers and their old values.
- Execution continues at the bytecode instruction immediately following the invoke instruction that caused this method invocation.
- The return value can be consumed by (exactly) the first instruction following the invoke-kind or invoke-kind/range instruction that caused this method invocation, and this instructions needs to be a move-result-object instruction.

## Exceptions

None.