Contents | Prev | Next | IndexThe JavaTM Virtual Machine Specification


A B C D F G I J L M N P R S T W

jsr

Operation

Jump subroutine

Format

jsr
branchbyte1
branchbyte2

Forms

jsr = 168 (0xa8)

Operand Stack

... ..., address

Description

The address of the opcode of the instruction immediately following this jsr instruction is pushed onto the operand stack as a value of type returnAddress. The unsigned branchbyte1 and branchbyte2 are used to construct a signed 16-bit offset, where the offset is (branchbyte1 << 8) | branchbyte2. Execution proceeds at that offset from the address of this jsr instruction. The target address must be that of an opcode of an instruction within the method that contains this jsr instruction.

Notes

The jsr instruction is used with the ret instruction in the implementation of the finally clauses of the Java programming language (see Section 7.13, "Compiling finally"). Note that jsr pushes the address onto the operand stack and ret gets it out of a local variable. This asymmetry is intentional.


jsr_w

Operation

Jump subroutine (wide index)

Format

jsr_w
branchbyte1
branchbyte2
branchbyte3
branchbyte4

Forms

jsr_w = 201 (0xc9)

Operand Stack

... ..., address

Description

The address of the opcode of the instruction immediately following this jsr_w instruction is pushed onto the operand stack as a value of type returnAddress. The unsigned branchbyte1, branchbyte2, branchbyte3, and branchbyte4 are used to construct a signed 32-bit offset, where the offset is (branchbyte1 << 24) | (branchbyte2 << 16) | (branchbyte3 << 8) | branchbyte4. Execution proceeds at that offset from the address of this jsr_w instruction. The target address must be that of an opcode of an instruction within the method that contains this jsr_w instruction.

Notes

The jsr_w instruction is used with the ret instruction in the implementation of the finally clauses of the Java programming language (see Section 7.13, "Compiling finally"). Note that jsr_w pushes the address onto the operand stack and ret gets it out of a local variable. This asymmetry is intentional.

Although the jsr_w instruction takes a 4-byte branch offset, other factors limit the size of a method to 65535 bytes (§4.10). This limit may be raised in a future release of the Java virtual machine.


Contents | Prev | Next | Index

The JavaTM Virtual Machine Specification
Copyright © 1999 Sun Microsystems, Inc. All rights reserved
Please send any comments or corrections to jvm@java.sun.com