wiki:JooPo usage

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


JooPo usage

JooPo is not yet fully implemented. Here you find preliminary information about what we know already or plan to incorporate.


As is planned, JooPo will output two files.

The first one is a classfile, in which all elements are at strictest protected. The classfile will have abstract methods for all loopo source methods in order to be refined by the loopo output. The classfile will also have methods to be called from the loopo source for more complex operation carried out from within the superclass.

The second one is a loopo source file with extracted recognized loopo loops fit into methods bodies. The loop bodies will state the dependences and use calls to the superclass methods to pass their interrelation.



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

Basic block discretization

Operand stack leftovers are not permitted between machine code basic blocks, meaning they all must operate the stack independent of each other.

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.

Loopo paragraphs

As is planned, loopo paragraphs impose various restrictions on the array usage within them. There may not be duplicate references to the same target, which is not be checked, yet may render invalid output. All references used in a loopo paragraph must occur within the recognized array dependencies, i.e. validly operating on indexed elements. Also references may only be themselves in locals or refer to an element whose class is given in a local.