Flexible representation analysis

Statically typed languages with Hindley-Milner polymorphism have long been compiled using inefficient and fully boxed data representations. Recently, several new compilation methods have been proposed to support more efficient and unboxed multi-word representations. Unfortunately, none of these techniques is fully satisfactory. For example, Leroy's coercion-based approach does not handle recursive data types and mutable types well. The type-passing approach (proposed by Harper and Morrisett) handles all data objects, but it involves extensive runtime type analysis and code manipulations.This paper presents a new flexible representation analysis technique that combines the best of both approaches. Our new scheme supports unboxed representations for recursive and mutable types, yet it only requires little runtime type analysis. In fact, we show that there is a continuum of possibilities between the coercion-based approach and the type-passing approach. By varying the amount of boxing and the type information passed at runtime, a compiler can freely explore any point in the continuum---choosing from a wide range of representation strategies based on practical concerns. Finally, our new scheme also easily extends to handle type abstractions across ML-like higher-order modules.

[1]  Zhong Shao,et al.  Compiling standard ML for efficient execution on modern machines , 1994 .

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

[3]  Peter Thiemann,et al.  Unboxed values and polymorphic typing revisited , 1995, FPCA '95.

[4]  ShaoZhong Flexible representation analysis , 1997 .

[5]  David Tarditi,et al.  Design and Implementation of Code Optimizations for a Type-Directed Compiler for Standard ML. , 1996 .

[6]  Xavier Leroy,et al.  Manifest types, modules, and separate compilation , 1994, POPL '94.

[7]  Jack W. Davidson,et al.  A formal model and specification language for procedure calling conventions , 1995, POPL '95.

[8]  Richard C. H. Connor,et al.  An ad hoc approach to the implementation of polymorphism , 1991, TOPL.

[9]  Nikolaj Skallerud Bjjrner,et al.  Minimal Typing Derivations , 1994 .

[10]  Dominique Clément,et al.  A simple applicative language: mini-ML , 1986, LFP '86.

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

[12]  Robin Milner,et al.  Definition of standard ML , 1990 .

[13]  Gerry Kane,et al.  MIPS RISC Architecture , 1987 .

[14]  Jack W. Davidson,et al.  A Formal Model for Procedure Calling Conventions , 1994 .

[15]  Mads Tofte,et al.  A Semantics for Higher-Order Functors , 1994, ESOP.

[16]  Peter Lee,et al.  Optimizing ML with run-time code generation , 1996, PLDI '96.

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

[18]  Dawson R. Engler,et al.  VCODE: a retargetable, extensible, very fast dynamic code generation system , 1996, PLDI '96.

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

[20]  Andrew W. Appel,et al.  A critique of Standard ML , 1993, Journal of Functional Programming.

[21]  Mark Lillibridge,et al.  A type-theoretic approach to higher-order modules with sharing , 1994, POPL '94.

[22]  Robin Milner,et al.  Principal type-schemes for functional programs , 1982, POPL '82.

[23]  Fritz Henglein,et al.  Formally optimal boxing , 1994, POPL '94.

[24]  A. K. Wmght Polymorphism for imperative languages without imperative types , 1993 .

[25]  Andrew W. Appel,et al.  Compiling with Continuations , 1991 .

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

[27]  Mark P. Jones Dictionary-free overloading by partial evaluation , 1995, LISP Symb. Comput..

[28]  Greg Morrisett,et al.  Compiling with Types , 1995 .

[29]  Xavier Leroy,et al.  Unboxed objects and polymorphic typing , 1992, POPL '92.

[30]  Simon L. Peyton Jones,et al.  Unboxed Values as First Class Citizens in a Non-Strict Functional Language , 1991, FPCA.

[31]  John C. Mitchell,et al.  On the type structure of standard ML , 1993, TOPL.

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

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

[34]  Brian N. Bershad,et al.  Fast, effective dynamic compilation , 1996, PLDI '96.