Type-preserving compilation of Featherweight Java

We present an efficient encoding of core Java constructs in a simple, implementable typed intermediate language. The encoding, after type erasure, has the same operational behavior as a standard implementation using vtables and self-application for method invocation. Classes inherit super-class methods with no overhead. We support mutually recursive classes while preserving separate compilation. Our strategy extends naturally to a significant subset of Java, including interfaces and privacy. The formal translation using Featherweight Java allows comprehensible type-preservation proofs and serves as a starting point for extending the translation to new features. Our work provides a foundation for supporting certifying compilation of Java-like class-based languages in a type-theoretic framework.

[1]  John C. Mitchell,et al.  F-bounded polymorphism for object-oriented programming , 1989, FPCA.

[2]  John C. Reynolds,et al.  Towards a theory of type structure , 1974, Symposium on Programming.

[3]  Karl Crary,et al.  What is a recursive module? , 1999, PLDI '99.

[4]  Karl Crary,et al.  Simple, Efficient Object Encoding using Intersection Types , 1998 .

[5]  Martín Abadi,et al.  Syntactic considerations on recursive types , 1996, Proceedings 11th Annual IEEE Symposium on Logic in Computer Science.

[6]  John H. Reppy,et al.  A Calculus for Compiling and Linking Classes , 2000, ESOP.

[7]  John H. Hartman,et al.  Toba: Java for Applications - A Way Ahead of Time (WAT) Compiler , 1997, COOTS.

[8]  Andrew W. Appel,et al.  A type-based compiler for standard ML , 1995, PLDI '95.

[9]  Robert Harper,et al.  Compiling polymorphism using intensional type analysis , 1995, POPL '95.

[10]  Robert Harper,et al.  A type-theoretic interpretation of standard ML , 2000, Proof, Language, and Interaction.

[11]  Philip Wadler,et al.  Featherweight Java: a minimal core calculus for Java and GJ , 1999, OOPSLA '99.

[12]  Benjamin C. Pierce,et al.  Simple type-theoretic foundations for object-oriented programming , 1994, Journal of Functional Programming.

[13]  Samuel N. Kamin Inheritance in smalltalk-80: a denotational definition , 1988, POPL '88.

[14]  George C. Necula,et al.  Safe kernel extensions without run-time checking , 1996, OSDI '96.

[15]  Zhong Shao,et al.  Representing Java classes in a typed intermediate language , 1999, ICFP '99.

[16]  Dan Grossman,et al.  TALx86: A Realistic Typed Assembly Language∗ , 1999 .

[17]  ScienceYale UniversityNew Haven An Overview of the Flint/ml Compiler , 1997 .

[18]  John H. Reppy,et al.  The design of a class mechanism for Moby , 1999, PLDI '99.

[19]  Didier Rémy,et al.  Objective ML: a simple object-oriented extension of ML , 1997, POPL '97.

[20]  P. Wadler,et al.  A Second Look at Overloading In Proc. FPCA'95 Conf. on Functional Programming Languages and Computer Architecture , 1995 .

[21]  Zhong Shao,et al.  Type-preserving compilation of featherweight java , 2003, Foundations of Intrusion Tolerant Systems, 2003 [Organically Assured and Survivable Information Systems].

[22]  Healfdene Goguen Typed Operational Semantics , 1995, TLCA.

[23]  Robert Harper,et al.  TIL: a type-directed optimizing compiler for ML , 1996, PLDI '96.

[24]  Luca Cardelli,et al.  Abstract Types and the Dot Notation , 1990, Programming Concepts and Methods.

[25]  Christopher League,et al.  Functional Java Bytecode ∗ , 2001 .

[26]  George C. Necula,et al.  Proof-carrying code , 1997, POPL '97.

[27]  Peter Lee,et al.  TIL: a type-directed, optimizing compiler for ML , 2004, SIGP.

[28]  Guy L. Steele,et al.  The Java Language Specification , 1996 .

[29]  Didier Rémy Syntactic theories and the algebra of record terms , 1992 .

[30]  Martin Odersky,et al.  Making the future safe for the past: adding genericity to the Java programming language , 1998, OOPSLA '98.

[31]  Dexter Kozen,et al.  Low-Level Type Systems for Modularity and Object-Oriented Constructs , 1999 .

[32]  Scott F. Smith,et al.  An interpretation of typed OOP in a language with state , 1995, LISP Symb. Comput..

[33]  Atsushi Igarashi,et al.  On Inner Classes , 2002, Inf. Comput..

[34]  Kim B. Bruce A paradigmatic object-oriented programming language: Design, static typing and semantics , 1994, Journal of Functional Programming.

[35]  Andreas Krall,et al.  CACAO - A 64-bit JavaVM Just-in-Time Compiler , 1997, Concurr. Pract. Exp..

[36]  Neal Glew,et al.  An efficient class and object encoding , 2000, OOPSLA '00.

[37]  John C. Mitchell,et al.  Abstract types have existential types , 1985, POPL.

[38]  Karl Crary Typed compilation of inclusive subtyping , 2000, ICFP '00.

[39]  John C. Mitchell,et al.  On the Relationship Between Classes, Objects, and Data Abstraction , 1998, Theory Pract. Object Syst..

[40]  J. Y. Girard,et al.  Interpretation fonctionelle et elimination des coupures dans l'aritmetique d'ordre superieur , 1972 .

[41]  Suresh Jagannathan,et al.  Compiling Java to a Typed Lambda-Calculus: A Preliminary Report , 1998, Tic.

[42]  Philip Wadler,et al.  The Glasgow Haskell Compiler: a technical overview , 1993 .

[43]  Luca Cardelli,et al.  Comparing Object Encodings , 1997, TACS.

[44]  Martín Abadi,et al.  A Theory of Objects , 1996, Monographs in Computer Science.

[45]  Martín Abadi,et al.  An interpretation of objects and object types , 1996, POPL '96.

[46]  Joseph C. Vanderwaart Typed Intermediate Representations for Compiling Object-Oriented Languages , 1999 .

[47]  Zhong Shao,et al.  Implementing typed intermediate languages , 1998, ICFP '98.

[48]  Peter Lee,et al.  The TIL/ML Compiler: Performance and Safety through Types , 1996 .