next up previous contents
Next: Method Instructions Up: The Instruction Set Previous: Stack Manipulation Instructions

Branch and Comparison Instructions

 

The branch instructions transfer control between instructions.

There are instructions to compare a value of type int on the opernad stack to zero in all possible ways and branch on succes. Other conditional branch instructions include comparing a reference on the operand stack to null and comparing values of type int or type reference. All branching instructions have the offset to the instruction to branch to as their operands.

Non-branching comparison instructions are available to compare values of type long, float or double. These instruction push the result of the comparison on the operand stack.

The following instructions are conditional branch instructions used to compile the Java switch statement (the case statement in Pascal). The tableswitch instruction is used when the case values of the switch can be efficiently used as indices into the table of target offsets. When the case values of the switch are sparse, it becomes more efficient to use the lookupswitch instruction. Both instructions only operate on int values; values types float, long and double have to be converted to int first.

Besides instructions to jump to and return from a subroutine, there also are the following unconditional branch instructions:



next up previous contents
Next: Method Instructions Up: The Instruction Set Previous: Stack Manipulation Instructions



mark@bottom.xs4all.nl