Abstract
Precise type information is invaluable for analysis and optimization of object-oriented programs. Some forms of polymorphism found in object-oriented languages pose significant difficulty for type inference, in particular data polymorphism. Agesen’s Cartesian Product Algorithm (CPA) can analyze programs with parametric polymorphism in a reasonably precise and efficient manner, but CPAl oses precision for programs with data polymorphism. This paper presents a precise constraintbased type inference system for Java. It uses Data-Polymorphic CPA (DCPA), a novel constraint-based type inference algorithm which extends CPA with the ability to accurately and efficiently analyze data polymorphic programs. The system is implemented for the full Java language, and is used to statically verify the correctness of Java downcasts. Benchmark results are given which show that DCPAi s significantly more accurate than CPAan d the efficiency of DCPAis close to CPA.
Keywords
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.
Partial funding provided by NSF grants CCR-9619843 and CCR-9988491
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Preview
Unable to display preview. Download preview PDF.
References
Alexander Aiken, Manuel Fhndrich, Jeffrey S. Foster, and Zhendong Su. Partial online cycle elimination in inclusion constraint graphs. In ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI), 1998.
Ole Agesen. The cartesian product algorithm. In Proceedings ECOOP’95, volume 952 of Lecture notes in Computer Science, 1995.
Ole Agesen. Concrete Type Inference: Delivering Object-Oriented Applications. PhD thesis, Stanford University, 1996. Available as Sun Labs Technical Report SMLI TR-96-52.
A. Aiken and E. L. Wimmers. Type inclusion constraints and type inference. In Proceedings of the International Conference on Functional Programming Languages and Computer Architecture, pages 31–41, 1993.
Robert O’ Callahan. Optimizing a solver of polymorphism constraints: SEMI. Technical Report CMU-CS-99-136, CMU, June 1999.
Dominic Duggan. Modular type-based reverse engineering of parameterized types in java code. In ACM SIGPLAN Symposium on Object-Oriented Programming: Systems, Languages and Applications (OOPSLA), 1999.
Jonathan Eifrig, Scott Smith, and Çois Pottier. A framework for type inference with subtyping. In Proceedings of the third ACM SIGPLAN International Conference on Functional Programming (ICFP’98), September 1998.
Jens Palsberg and Christina Pavlopoulou. From polyvariant flow information to intersection and union types. In POPL, 1998.
Olin Shivers. Control-Flow Analysis of Higher-Order Languages. PhD thesis, Carnegie-Mellon University, 1991. Available as CMU Technical Report CMU-CS-91-145.
V. Sundaresan, L. Hendren, C. Razafimahefa, R. Valee-Rai, P. Lam, E. Gagnon, and C. Godin. Practical virtual method call resolution for java. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), 2000.
Scott Smith and Tiejun Wang. Polyvariant flow analysis with constrained types. In Gert Smolka, editor, Proceedings of the 2000 European Symposium on Programming (ESOP’00), volume 1782 of Lecture Notes in Computer Science, pages 382–396. Springer Verlag, March 2000.
F. Tip, C. Laffra, P. Sweeney, and D. Streeter. Practical experience with an application extractor for java. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), 1999.
F. Tip and J. Palsberg. Scalable propagation-based call graph construction. In ACM Conference on Object-Oriented Programming Systems, Languages, and Applications (OOPSLA), 2000.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2001 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Wang, T., Smith, S.F. (2001). Precise Constraint-Based Type Inference for Java. In: Knudsen, J.L. (eds) ECOOP 2001 — Object-Oriented Programming. ECOOP 2001. Lecture Notes in Computer Science, vol 2072. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-45337-7_6
Download citation
DOI: https://doi.org/10.1007/3-540-45337-7_6
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-42206-8
Online ISBN: 978-3-540-45337-6
eBook Packages: Springer Book Archive