Contents | Prev | Next | Index | The JavaTM Virtual Machine Specification |
ret | |
index |
Description
The index is an unsigned byte between 0 and 255, inclusive. The local variable at index in the current frame (§3.6) must contain a value of type returnAddress
. The contents of the local variable are written into the Java Virtual Machine's pc
register, and execution continues there.
Notes
The ret instruction is used with jsr or jsr_w instructions in the implementation of the finally
keyword of the Java language (see Section 7.13, "Compiling finally"). Note that jsr pushes the address onto the stack and ret gets it out of a local variable. This asymmetry is intentional.
The ret instruction should not be confused with the return instruction. A return instruction returns control from a Java method to its invoker, without passing any value back to the invoker.
The ret opcode can be used in conjunction with the wide instruction to access a local variable using a two-byte unsigned index.
void
from methodreturn |
Description
The returning method must have return type void
. Any values on the operand stack of the current frame (§3.6) are discarded. If the returning method is a synchronized
method, the monitor acquired or reentered on invocation of the method is released or exited (respectively) as if by execution of a monitorexit instruction.
The interpreter then returns control to the invoker of the method, reinstating the frame of the invoker.
Contents | Prev | Next | Index
Java Virtual Machine Specification
Copyright © 1996, 1997 Sun Microsystems, Inc.
All rights reserved
Please send any comments or corrections to jvm@java.sun.com