Representing Java classes in a typed intermediate language

We propose a conservative extension of the polymorphic lambda calculus (Fω) as an intermediate language for compiling languages with name-based class and interface hierarchies. Our extension enriches standard Fω with recursive types, existential types, and row polymorphism, but only ordered records with no subtyping. Basing our language on Fω makes it also a suitable target for translation from other higher-order languages; this enables the safe interoperation between class-based and higher-order languages and the reuse of common type-directed optimization techniques, compiler back ends, and runtime support.We present the formal semantics of our intermediate language and illustrate its features by providing a formal translation from a subset of Java, including classes, interfaces, and private instance variables. The translation preserves the name-based hierarchical relation between Java classes and interfaces, and allows access to private instance variables of parameters of the same class as the one defining the method. It also exposes the details of method invocation and instance variable access and allows many standard optimizations to be performed on the object-oriented code.

[1]  John C. Mitchell,et al.  Type systems for object-oriented programming languages , 1996 .

[2]  Zhong Shao Typed common intermediate format , 2000, SOEN.

[3]  Martin Odersky,et al.  Pizza into Java : Translating theory into practiceMartin , 1997 .

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

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

[6]  Martin Hofmann,et al.  A unifying type-theoretic framework for objects , 1994, Journal of Functional Programming.

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

[8]  Neal Glew Type dispatch for named hierarchical types , 1999, ICFP '99.

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

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

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

[12]  Luca Cardelli,et al.  On Binary Methods , 1995, Theory Pract. Object Syst..

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

[14]  Martin Hofmann,et al.  A unifying type-theoretic framework for objects , 1994, Journal of Functional Programming.

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

[16]  Andreas Krall,et al.  CACAO — A 64‐bit JavaVM just‐in‐time compiler , 1997 .

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

[18]  Matthias Felleisen,et al.  A Programmer's Reduction Semantics for Classes and Mixins , 1999, Formal Syntax and Semantics of Java.

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

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

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

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

[23]  Nick Benton,et al.  Compiling standard ML to Java bytecodes , 1998, ICFP '98.

[24]  Xavier Leroy,et al.  Security properties of typed applets , 1998, POPL '98.

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

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

[27]  Luca Cardelli,et al.  A Semantic Basis for Quest , 1991, J. Funct. Program..

[28]  Zhong Shao Typed cross-module compilation , 1998, ICFP '98.

[29]  Frank Yellin,et al.  The Java Virtual Machine Specification , 1996 .

[30]  Andrew W. Appel,et al.  Standard ML of New Jersey , 1991, PLILP.

[31]  Jens Palsberg,et al.  Trust in the λ-calculus , 1995, Journal of Functional Programming.

[32]  Sophia Drossopoulou,et al.  Java is Type Safe - Probably , 1997, ECOOP.

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

[34]  David Grove,et al.  Vortex: an optimizing compiler for object-oriented languages , 1996, OOPSLA '96.

[35]  Jon G. Riecke,et al.  The SLam calculus: programming with secrecy and integrity , 1998, POPL '98.

[36]  Luca Cardelli,et al.  Comparing Object Encodings , 1997, Inf. Comput..