Jimple

Jimple is an intermediate representation of a Java program designed as an alternative to the stack-based Java bytecode. It is typed and based on three address code. Jimple also defines a concrete syntax.
Introduction
Jimple is intended to be easier to optimize than java bytecode. It includes only 15 different operations, thus simplifying flow analysis. By contrast, java bytecode includes over 200 different operations.
In Jimple, local (and stack) variables are typed and hence Jimple is inherently type safe. This is not the case for java bytecode, whose type safety has to be checked by the bytecode verifier.
Shimple is an SSA (static single assignment) variant and Grimp is an aggregated version of Jimple. Those three representations are used by the Soot Java optimization framework.
The main task of Jimple is conversion of bytecode to three address code. This task is called "Jimplifying", a pun on "simplifying". The idea behind the conversion, first investigated by Clark Verbrugge, is to associate a variable to each position in the stack. Hence stack operations become assignments involving the stack variables.
Example
Consider the following bytecode, which is from the paper:
<pre>
iload 1 // load variable x1, and push it on the stack
iload 2 // load variable x2, and push it on the stack
iadd // pop two values, and push their sum on the stack
istore 1 // pop a value from the stack, and store it in variable x1
</pre>
The above translates to the following three address code:
<pre>
stack1 = x1 // iload 1
stack2 = x2 // iload 2
stack1 = stack1 + stack2 // iadd
x1 = stack1 // istore 1
</pre>
In general the resulting code does not have static single assignment form.
 
< Prev   Next >