wiki:JooPo usage

Version 5 (modified by schuhmac, 9 years ago) (diff)


JooPo usage


Bytecode recognition is based on the second edition of the java virtual machine specification.

Block structure

As of now, there are various restraints to the code recognized. Our method recognizes cleanly block structured code

  • with exits terminating some blocks,
  • breaks (exits from infinite loops on their top scope),
  • and, within certain limits, collapses (blocks need not be terminated by a uniting instruction).

It relies on switch instruction bytecode not inducing cycles.

Block structure as required by joopo is usually output by the java compiler, if you do not use continue nor break statements in loops, use breaks in all switch statement cases, and if there is at least one instruction after the last inner block to any loop, which hinders the optimizer from streamlining the jumps.

In any unforseeable case anything still should not work, be sure to write at least one instruction before the end of any block in order to confound the optimizer.

Count loops

Count loop detection is done purely syntactically, i.e. only checking for a certain fixed scheme, that one which is exerted by the standard java compiler. It expects a variable initialization terminating the last paragraph before the loop, an infinite loop terminated by an addition of the variable, and a break with the inverted loop condition as first statement beginning the loop. The variable may not be written in the loop body except for the addition.