Jimple
Encyclopedia
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.
.
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.
The above translates to the following three address code:
In general the resulting code does not have static single assignment form
.
Java (programming language)
Java is a programming language originally developed by James Gosling at Sun Microsystems and released in 1995 as a core component of Sun Microsystems' Java platform. The language derives much of its syntax from C and C++ but has a simpler object model and fewer low-level facilities...
program designed as an alternative to the stack-based Java bytecode
Java bytecode
Java bytecode is the form of instructions that the Java virtual machine executes. Each bytecode opcode is one byte in length, although some require parameters, resulting in some multi-byte instructions. Not all of the possible 256 opcodes are used. 51 are reserved for future use...
. It is typed and based on three address code
Three address code
In computer science, three-address code is a form of representing intermediate code used by compilers to aid in the implementation of code-improving transformations...
. 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 operationsJava bytecode instruction listings
This is a list of the instructions that make up the Java bytecode, an abstract machine language that is ultimately executed by the Java virtual machine...
.
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
Soot (computer science)
Soot is a language manipulation and optimization framework consisting of intermediate languages for the Java programming language. It has been developed by the Sable Research Group at McGill University known for its SableVM, a Java virtual machine and the AspectBench Compiler, an open research...
.
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:
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
The above translates to the following three address code:
stack1 = x1 // iload 1
stack2 = x2 // iload 2
stack1 = stack1 + stack2 // iadd
x1 = stack1 // istore 1
In general the resulting code does not have static single assignment form
Static single assignment form
In compiler design, static single assignment form is a property of an intermediate representation , which says that each variable is assigned exactly once...
.