jsr_w <label>
<label>
is a label name. To define the location of the label, use the <label>
name followed by a colon:
<label>:<label> then becomes associated the address of the following instruction. Labels can only be assigned one location in a method. On the other hand, a single <label> can be the target of multiple branch instructions.
Stack
Before
Description
After
...
return-address
...
This calls a local subroutine defined within the body of a method. It is used to implement Java's finally clause.
jsr_w first pushes the address (pc + 5) onto the operand stack, where pc is the address of this jsr_w instruction in the bytecode. The address (pc + 5) is the address of instruction that immediately follows the jsr_w instruction in bytecode - it is used used by the ret instruction to return from the subroutine.
Next, execution branches to the address (pc + branchoffset), where pc is the address of the jsr_w opcode in the bytecode and branchoffset is the 32-bit signed integer parameter following the jsr_w opcode in the bytecode. If you are using Jasmin, branchoffset is computed for you from the address of <label>.
Bytecode
Type
See Also
Description
u1
jsr_w
opcode = 0xC9 (201)
s4
branchoffset
jsr, ret, goto, goto_w
Notes
1. jsr_w is identical to the jsr instruction except that it uses a 32-bit wide offset instead of a 16-bit wide offset.
2. Addresses are measured in bytes from the start of the bytecode (i.e. address 0 is the first byte in the bytecode of the currently executing method). The maximum address in a method is 65535.
3. In Jasmin, jsr and jsr_w are synonymous, since the Jasmin assembler automatically decides which version of the instruction to use, based on the address of the<label>.