Partial Program Analysis for Soot/Polyglot
The current version of PPA for Polyglot is 0.1 and it is based on modified versions of Polyglot 1.3.5 and Soot 2.2.4. Only bug fixes will be released in the future.
PPA, Soot, Polyglot and Jasmin are available under the GNU Lesser General Public License.
You can download the source code. The format is a zip file containing the three Eclipse projects needed to build and run PPA (Polyglot, Jasmin, and Soot).
You can download an executable jar file. This jar file can also be used as a library if you want to access PPA programmatically.
Example 1 - Producing a Jimple File
This example will show you how to transform one Java source file into a Jimple file even if most of the dependencies of the source file is missing. We make the following assumptions concerning the file system:
- The file A.java is in examples/src/test/ppa
- The rt.jar file from Java 1.4 is in the current directory
- The file ppa_0.1.jar is in the current directory
Run the following command:
java -jar ppa_0.1.jar -src-prec java -f jimple -allow-phantom-refs -d
examples/output -cp rt.jar:examples/src test.ppa.A
The file test.ppa.A.jimple will be created in the examples/output folder. You can see how PPA inferred the various missing types. You can also access the Jimple representation programmatically by calling Soot with the parameters mentionned above (you can use this code example). You can also look at the Soot API documentation.
Example 2 - Accessing the AST
It is also possible to access the Abstract Syntax Tree of a partial program. This code example shows you how to do it. The file system assumptions are the same as in Example 1. You can also look at the Polyglot API to learn how to use the AST.
- The technical report describing the implementation and evaluation of PPA.
- The Soot webpage.
- Tutorials on how to use Soot.
- The Polyglot webpage.
- Initial drop from the repository: we used this code to parse and analyze Lucene, JFreeChart, Jython, Spring and Eclipse.
- Support for Java 1.4 only.
- This version can be used to analyze several thousand files in a row. Contact the author to know how to configure the tool to prevent memory leak.
- Debugging statements and empirical instrumentation are still in the code.