ACM Home Page
Please provide us with feedback. Feedback
Efficient local type inference
Full text PdfPdf (720 KB)
Source
Conference on Object Oriented Programming Systems Languages and Applications archive
Proceedings of the 23rd ACM SIGPLAN conference on Object-oriented programming systems languages and applications table of contents
Nashville, TN, USA
SESSION: Type inference and tools table of contents
Pages 475-492  
Year of Publication: 2008
ISBN:978-1-60558-215-3
Also published in ...
Authors
Ben Bellamy  University of Oxford, Oxford, United Kingdom
Pavel Avgustinov  University of Oxford, Oxford, United Kingdom
Oege de Moor  University of Oxford, Oxford, United Kingdom
Damien Sereni  University of Oxford, Oxford, United Kingdom
Sponsors
SIGPLAN: ACM Special Interest Group on Programming Languages
ACM: Association for Computing Machinery
Publisher
ACM  New York, NY, USA
Bibliometrics
Downloads (6 Weeks): 18,   Downloads (12 Months): 158,   Citation Count: 0
Additional Information:

abstract   references   index terms   collaborative colleagues  

Tools and Actions: Request Permissions Request Permissions    Review this Article  
DOI Bookmark: Use this link to bookmark this Article: http://doi.acm.org/10.1145/1449764.1449802
What is a DOI?

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
 
8
 
9
 
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
21
 
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

Collaborative Colleagues:
Ben Bellamy: colleagues
Pavel Avgustinov: colleagues
Oege de Moor: colleagues
Damien Sereni: colleagues