Abstract
In a typed language such as Java, inlining of virtual methods does not always preserve typability. The best known solution to this problem is to insert type casts, which may hurt performance. This paper presents a solution that never hurts performance. The solution is based on a transformation that modifies static type annotations and changes some virtual calls into static calls, which can then be safely inlined. The transformation is parameterised by a flow analysis, and for any analysis that satisfies certain conditions, the transformation is correct and idempotent. The paper presents the transformation, the conditions on the flow analysis, and proves the correctness properties; all in the context of a variant of Featherweight Java.
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
Lars Ole Andersen. Self-applicable C program specialization. In Proceedings of PEPM’92, Workshop on Partial Evaluation and Semantics-Based Program Manipulation, pages 54–61, June 1992. (Technical Report YALEU/DCS/RR-909, Yale University).
Jeffrey Dean, David Grove, and Craig Chambers. Optimization of object-oriented programs using static class hierarchy analysis. In Proceedings of European Conference on Object-Oriented Programming, pages 77–101, Aarhus, Denmark, August 1995. Springer-Verlag (LNCS 952).
David Detlefs and Ole Agesen. Inlining of virtual methods. In Proceedings of ECOOP’99, pages 258–278. Springer-Verlag (LNCS 1628), 1999.
Manuel Fähndrich and Alexander Aiken. Program analysis using mixed term and set constraints. In Proceedings of SAS’97, International Static Analysis Symposium, pages 114–126. Springer-Verlag (LNCS), 1997.
Etienne M. Gagnon, Laurie J. Hendren, and Guillaume Marceau. Efficient inference of static types for Java bytecode. In Proceedings of SAS’00, International Static Analysis Symposium, pages 199–219. Springer-Verlag (LNCS 1824), 2000.
Neal Glew. An efficient class and object encoding. In Proceedings of OOPSLA’ 00, ACM SIGPLAN Conference on Object-Oriented Programming Systems, Languages and Applications, pages 311–324, Minneapolis, Minnesota, October 2000.
Nevin Heintze. Control-flow analysis and type systems. In Proceedings of SAS’95, International Static Analysis Symposium, pages 189–206. Springer-Verlag (LNCS 983), Glasgow, Scotland, September 1995.
Atsushi Igarashi, Benjamion Pierce, and Philip Wadler. Featherweight Java: A minimal core calculus for Java and GJ. In ACM SIGPLAN Conference on Object-Oriented Programming, Systems, Languages, and Applications, pages 132–146, Denver, CO, USA, October 1999.
Suresh Jagannathan, Andrew Wright, and Stephen Weeks. Type-directed flow analysis for typed intermediate languages. In Proceedings of SAS’97, International Static Analysis Symposium. Springer-Verlag (LNCS), 1997.
Todd Knoblock and Jakob Rehof. Type elaboration and subtype completion for Java Bytecode. ACM Transactions on Programming Languages and Systems, 23(2):243–272, March 2001.
Greg Morrisett, David Tarditi, Perry Cheng, Christopher Stone, Robert Harper, and Peter Lee. The TIL/ML compiler: Performance and safety through types. In ACM SIGPLAN Workshop on Compiler Support for System Software, Tucson, AZ, USA, February 1996.
Greg Morrisett, David Walker, Karl Crary, and Neal Glew. From System F to typed assembly language. ACM Transactions on Progamming Languages and Systems, 21(3):528–569, May 1999.
Flemming Nielson. The typed lambda-calculus with first-class processes. In Proceedings of PARLE, pages 357–373, April 1989.
Jens Palsberg. Closure analysis in constraint form. ACM Transactions on Programming Languages and Systems, 17(1):47–62, January 1995. Preliminary version in Proceedings of CAAP’94, Colloquium on Trees in Algebra and Programming, Springer-Verlag (LNCS 787), pages 276–290, Edinburgh, Scotland, April 1994.
Jens Palsberg. Equality-based flow analysis versus recursive types. ACM Transactions on Programming Languages and Systems, 20(6):1251–1264, 1998.
Jens Palsberg and Patrick M. O’Keefe. A type system equivalent to flow analysis. ACM Transactions on Programming Languages and Systems, 17(4):576–599, July 1995. Preliminary version in Proceedings of POPL’95, 22nd Annual SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 367–378, San Francisco, California, January 1995.
Jens Palsberg and Christina Pavlopoulou. From polyvariant flow information to intersection and union types. Journal of Functional Programming, 11(3):263–317, May 2001. Preliminary version in Proceedings of POPL’98, 25th Annual SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 197–208, San Diego, California, January 1998.
Jens Palsberg and Michael I. Schwartzbach. Object-Oriented Type Systems. John Wiley & Sons, 1994.
David Tarditi, Greg Morrisett, Perry Cheng, Christopher Stone, Robert Harper, and Peter Lee. TIL: A type-directed optimizing compiler for ML. In 1996 ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 181–192, Philadelphia, PA, USA, May 1996. ACM Press.
Andrew Wright and Matthias Felleisen. A syntactic approach to type soundness. Information and Computation, 115(1):38–94, 1994.
Andrew Wright, Suresh Jagannathan, Cristian Ungureanu, and Aaron Hertzmann. Compiling Java to a typed lambda-calculus: A preliminary report. In ACM Workshop on Types in Compilation, Kyoto, Japan, March 1998.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2002 Springer-Verlag Berlin Heidelberg
About this paper
Cite this paper
Glew, N., Palsberg, J. (2002). Type-Safe Method Inlining. In: Magnusson, B. (eds) ECOOP 2002 — Object-Oriented Programming. ECOOP 2002. Lecture Notes in Computer Science, vol 2374. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-47993-7_22
Download citation
DOI: https://doi.org/10.1007/3-540-47993-7_22
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-43759-8
Online ISBN: 978-3-540-47993-2
eBook Packages: Springer Book Archive