92.

prev next contents
ifge

jump if greater than or equal to zero

Jasmin Syntax
     ifge <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

After
value
...
...

Description

ifge pops the top int off the operand stack. If the int is greater than or equal to zero, execution branches to the address (pc + branchoffset), where pc is the address of the ifge opcode in the bytecode and branchoffset is a 16-bit signed integer parameter following the ifge opcode in the bytecode. If the int on the stack is less than zero, execution continues at the next instruction.

If you are using Jasmin, branchoffset is computed for you from the address of <label>.

Example

     iload_1         ; push the int value in local variable 1 onto the stack     ifge Label      ; if the value on the stack is >= 0, jump to Label     return          ; return if local variable 1 is less than zero Label:     ; execution continues here if local variable 1 is greater than or equals zero... 
Bytecode

Type

Description
u1
ifge opcode = 0x9C (156)
s2
branchoffset
See Also

ifnull, ifeq, iflt, ifne, ifnonnull, ifgt, ifle

Notes

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).


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