JVM Instructions for Branching

See goto statement in JVM Spec

Conditional branch on comparison to zero:

  • if_<cond>
  • by convention on booleans in Booleans and Data Representation, we can use if_eq to mean ifFalse
  • can use if_ne to mean ifTrue (because 1 is not equal to 0)

There are also conditional branches for comparison of two operands:

  • in general called if_icmpCOND for different 'COND'

We examine next: how to use these instructions to compile

  • control-flow operations
  • later, boolean expressions