Program modules, separate compilation, and intermodule optimisation

iii Abstract This thesis is about a framework for elaborating and interpreting module language constructs at compile time in such a way that (1) arbitrary compile time information about declared identiiers of a module may be propagated to other modules and (2) no code is generated for module language constructs. The framework for interpreting module language constructs is called static interpretation. More information about referenced identiiers than can be obtained from programmer provided interfaces is necessary for analyses such as region inference. Further, many other analyses improve sig-niicantly from availability of analysis speciic information about referenced identiiers. Static interpretation facilitates intermodule optimisation, yet, it still supports a variant of separate compilation called cut-oo incremental recompilation. The thesis is divided into three parts. The rst part is about the static properties of a small language called ModML, which features a small Core language and the essential constructs of the Standard ML Modules language. The second part develops the framework for static interpretation by showing how ModML can be compiled into an explicitly typed intermediate language. The third part describes the ML Kit with Regions compiler, which is based on the techniques developed in part one and part two.

[1]  Martin Elsman,et al.  An Optimizing Backend for the ML Kit Using a Stack of Regions , 1995 .

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

[3]  M. Tofte Operational Semantics and Polymorphic Type Inference , 1988 .

[4]  Xavier Leroy,et al.  Polymorphic typing of an algorithmic language , 1992 .

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

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

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

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

[9]  Andrew W. Appel,et al.  Smartest recompilation , 1993, POPL '93.

[10]  Andrew W. Appel,et al.  ML-Yacc User's Manual Version 2.4 , 2000 .

[11]  Xavier Leroy,et al.  A syntactic theory of type generativity and sharing , 1996, Journal of Functional Programming.

[12]  Mads Tofte,et al.  Implementation of the typed call-by-value λ-calculus using a stack of regions , 1994, POPL '94.

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

[14]  Martin Elsman Polymorphic Equality - No Tags Required , 1998, Types in Compilation.

[15]  Martin Elsman,et al.  Programming with regions in the ML Kit , 1997 .

[16]  Lars Birkedal,et al.  From region inference to von Neumann machines via region representation inference , 1996, POPL '96.

[17]  Xavier Leroy,et al.  Applicative functors and fully transparent higher-order modules , 1995, POPL '95.

[18]  Robin Milner,et al.  A Theory of Type Polymorphism in Programming , 1978, J. Comput. Syst. Sci..

[19]  Walter F. Tichy,et al.  Smart recompilation , 1986, TOPL.

[20]  Martin Elsman,et al.  Programming with regions in the ml kit (for version 4) , 1998 .

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

[22]  Pierre Weis,et al.  Bigloo: A Portable and Optimizing Compiler for Strict Functional Languages , 1995, SAS.

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

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

[25]  Claudio V. Russo Types for Modules , 2004, Electronic Notes in Theoretical Computer Science.

[26]  Robert Harper,et al.  An Interpretation of Standard ML in Type Theory , 1997 .

[27]  Luca Cardelli,et al.  Program fragments, linking, and modularization , 1997, POPL '97.

[28]  MLDavid B. MacQueenAT Reeections on Standard Ml , 1992 .

[29]  Lars Birkedal,et al.  A region inference algorithm , 1998, TOPL.

[30]  Rolf Adams,et al.  The cost of selective recompilation and environment processing , 1994, TSEM.

[31]  Aleksy Schubert,et al.  The EML Kit Version 1 , 1996 .

[32]  Mark P. Jones,et al.  From Hindley-Milner Types to First-Class Structures , 2001 .

[33]  Andrew W. Appel,et al.  Shrinking lambda Expressions in Linear Time , 1997, J. Funct. Program..