∟Flow Control Instructions

This section describes JVM instructions that change the flow of execution: *cmp*, if*, goto* and *switch.

What Are Flow Control Instructions? Flow control instructions change the execution flow with or without conditions. Their mnemonics have a pattern of *cmp*, if*, goto* or *switch.

The table below describes flow control instructions. P. is the count of bytes following the opcode as operation parameters. I. is the count elements consumed from the operand stack as operation input. O. is the count elements added to the operand stack as operation output. "V" in P. column indicates that the count varies.

Mnemonic       C.  P.  I.  O.  Description
-------------  --  --  --  --  ----------------------------------------
lcmp           94   0   2   1  Compare long a <|=|> b, result -1|0|1
fcmpl          95   0   2   1  float version of lcmp, result -1 on NaN
fcmpg          96   0   2   1  float version of lcmp, result 1 on NaN
dcmpl          97   0   4   1  double version of lcmp, result -1 on NaN
dcmpg          98   0   4   1  double version of lcmp, result 1 on NaN
ifeq           99   2   1   0  if operand = 0, go to given offset
ifne           9A   2   1   0  if operand != 0, go to given offset
iflt           9B   2   1   0  if operand < 0, go to given offset
ifge           9C   2   1   0  if operand >= 0, go to given offset
ifgt           9D   2   1   0  if operand > 0, go to given offset
ifle           9E   2   1   0  if operand <= 0, go to given offset
if_icmpeq      9F   2   2   0  if int a = b, go to given offset
if_icmpne      A0   2   2   0  if int a != b, go to given offset
if_icmplt      A1   2   2   0  if int a < b, go to given offset
if_icmpge      A2   2   2   0  if int a >= b, go to given offset
if_icmpgt      A3   2   2   0  if int a > b, go to given offset
if_icmple      A4   2   2   0  if int a <= b, go to given offset
if_acmpeq      A5   2   2   0  Address version of if_icmpeq
if_acmpne      A6   2   2   0  Address version of if_icmpne
goto           A7   2   0   0  Go to given offset
jsr            A8   2   0   2  Deprecated
ret            A9   1   0   0  Deprecated
tableswitch    AA   V   1   0  Switch based on given offset array
lookupswitch   AB   V   1   0  Switch based on given offset hash
ifnull         C6   2   1   0  if operand = null, go to given offset
ifnonnull      C7   2   1   0  if operand != null, go to given offset
goto_w         C8   4   0   0  Go to given wide offset (4-byte)

Table of Contents

 About This Book

 JVM (Java Virtual Machine) Specification

 Java HotSpot VM - JVM by Oracle/Sun

 java.lang.Runtime Class - The JVM Instance

 java.lang.System Class - The Operating System

 ClassLoader Class - Class Loaders

 Class Class - Class Reflections

 JVM Runtime Data Areas

 JVM Stack, Frame and Stack Overflow

 Thread Testing Program and Result

 CPU Impact of Multi-Thread Applications

 I/O Impact of Multi-Thread Applications

 CDS (Class Data Sharing)

 Micro Benchmark Runner and JVM Options

 Micro Benchmark Tests on "int" Operations

 Micro Benchmark Tests on "long" Operations

 Micro Benchmark Tests in JIT Compilation Mode

 Micro Benchmark Tests on "float" and "double" Operations

 OpenJ9 by Eclipse Foundation

 JRockit JVM 28.2.7 by Oracle Corporation

►JVM Bytecode and Instruction Set

 What Is JVM Bytecode

 What Is "javap" Command

 Walkthrough of "javap -c -v" Command Output

 JVM Method Frame Architecture

 What Is Constant Pool

 JVM Instruction Set

 Constant Loading Instructions

 Local Variable Array Instructions

 Shared Memory Instructions

 Arithmetic Operation Instructions

 Bitwise Operation Instructions

 Type Conversion Instructions

►Flow Control Instructions

 Method Invocation Instructions

 Miscellaneous Instructions

 JVM Assembler/Disassembler Tools

 Archived Tutorials

 References

 Index

 Full Version in PDF/EPUB