|
ABSTRACT
Inference of static types for local variables in Java bytecode is the first step of any serious tool that manipulates bytecode, be it for decompilation, transformation or analysis. It is important, therefore, to perform that step as accurately and efficiently as possible. Previous work has sought to give solutions with good worst-case complexity. We present a novel algorithm, which is optimised for the common case rather than worst-case performance. It works by first finding a set of minimal typings that are valid for all assignments, and then checking whether these minimal typings satisfy all uses. Unlike previous algorithms, it does not explicitly build a data structure of type constraints, and it is easy to implement efficiently. We prove that the algorithm produces a typing that is both sound (obeying the rules of the language) and as tight as possible. We then go on to present extensive experiments, comparing the results of the new algorithm against the previously best known method. The experiments include bytecode that is generated in other ways than compilation of Java source. The new algorithm is always faster, typically by a factor 6, but on some real benchmarks the gain is as high as a factor of 92. Furthermore, whereas that previous method is sometimes suboptimal, our algorithm always returns a tightest possible type. We also discuss in detail how we handle primitive types, which is a difficult issue due to the discrepancy in their treatment between Java bytecode and Java source. For the application to decompilation, however, it is very important to handle this correctly.
REFERENCES
Note: OCR errors may be found in this Reference List extracted from the full text article. ACM has opted to expose the complete List rather than only correct and linked references.
| |
1
|
abc. The AspectBench Compiler. Home page with downloads, FAQ, documentation, support mailing lists, and bug database. http://aspectbench.org.
|
| |
2
|
|
| |
3
|
|
| |
4
|
|
| |
5
|
Ben Bellamy, Pavel Avgustinov, Oege de Moor, and Damien Sereni. Implementation of our local type inference algorithm (including experiments). http://musketeer.comlab.ox.ac.uk/typeinference/, 2008.
|
| |
6
|
Eric Bodden. A denial-of-service attack on the java bytecode verifier. http://www.bodden.de/research/javados/, 2008.
|
 |
7
|
Alan Donovan , Adam Kiežun , Matthew S. Tschantz , Michael D. Ernst, Converting java programs to use generic libraries, Proceedings of the 19th annual ACM SIGPLAN conference on Object-oriented programming, systems, languages, and applications, October 24-28, 2004, Vancouver, BC, Canada
|
| |
8
|
|
| |
9
|
James Gosling , Bill Joy , Guy Steele , Gilad Bracha, Java Language Specification, Second Edition: The Java Series, Addison-Wesley Longman Publishing Co., Inc., Boston, MA, 2000
|
| |
10
|
Justin Owen Graver. Type-Checking and Type Inference for Object-Oriented Programming Languages. PhD thesis, University of Illinois at Urbana-Champaign, 1989.
|
 |
11
|
|
| |
12
|
Andreas V. Hense. Polymorphic Type Inference for Object-Oriented Programming Languages. PhD thesis, Universität des Saarlandes, 1994.
|
| |
13
|
Eric J. Holstege. Type Inference in a Declarationless, Object-Oriented Language. PhD thesis, California Institute of Technology, 1982. Technical report 5035.
|
| |
14
|
Bronisłav Knaster. Un théorème sur les fonctions d'ensembles. Annales de la Societé Polonaise de Mathematique, 6:133--134, 1928.
|
 |
15
|
|
| |
16
|
|
| |
17
|
|
| |
18
|
|
| |
19
|
|
 |
20
|
Jens Palsberg , Michael I. Schwartzbach, Object-oriented type inference, Conference proceedings on Object-oriented programming systems, languages, and applications, p.146-161, October 06-11, 1991, Phoenix, Arizona, United States
|
 |
21
|
John Plevyak , Andrew A. Chien, Precise concrete type inference for object-oriented languages, Proceedings of the ninth annual conference on Object-oriented programming systems, language, and applications, p.324-340, October 23-28, 1994, Portland, Oregon, United States
|
| |
22
|
|
| |
23
|
Michael B. Smyth. Power domains. Journal of Computer and System Sciences, 16:23--96, 1978.
|
| |
24
|
Steven Alexander Spoon. Demand-driven type inference with subgoal pruning. PhD thesis, Georgia Institute of Technology, 2005.
|
 |
25
|
|
| |
26
|
Raja Vallée-Rai , Etienne Gagnon , Laurie J. Hendren , Patrick Lam , Patrice Pominville , Vijay Sundaresan, Optimizing Java Bytecode Using the Soot Framework: Is It Feasible?, Proceedings of the 9th International Conference on Compiler Construction, p.18-34, March 25-April 02, 2000
|
|