147.

prev next contents
iinc

increment integer in local variable

Jasmin Syntax
     iinc <varnum> <n> or     wide     iinc <varnum> <n> 
In the first form, <varnum> is an unsigned integer in the range 0 to 0xFF and <n> is a signed integer in the range -128 to 127. In the second (wide) form, <varnum> is an unsigned integer in the range 0 to 0xFFFF and <n> is a signed integer in the range -32768 to <= 32767.

Stack

Before

After
...
...
Description

iinc increments the int held in the local variable <varnum> by <n>. The iinc instruction takes two parameters: <varnum> is an unsigned integer which indicates which local variable should be used. <n> is the integer amount to increment or decrement the variable by. <varnum> must be a valid local variable number in the current method's frame.

Example

 iinc 1 10       ; increment local variable 1 by 10. iinc 1 -1       ; decrement local variable 1 by 1. 
Bytecode

For local variable numbers in the range 0-255, and values of <n> in the range -128 to 127, use:

Type

Description
u1
iinc opcode = 0x84 (132)
u1
<varnum>
s1
<n>
There is also a wide format for this instruction, which supports access to all local variables from 0 to 65535, and values of <n> between -32768 and 32767:

Type

Description
u1
wide opcode = 0xC4 (196)
u1
iinc opcode = 0x84 (132)
u2
<varnum>
s2
<n>
See Also

wide


prev next contents
Java Virtual Machine, by Jon Meyer and Troy Downing, O'Reilly Associates


Java Virtual Machine
Java Virtual Machine (Java Series)
ISBN: 1565921941
EAN: 2147483647
Year: 1996
Pages: 171

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net