Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
article
Free access

Typed cross-module compilation

Published: 29 September 1998 Publication History
  • Get Citation Alerts
  • Abstract

    Higher-order modules are very effective in structuring large programs and defining generic, reusable software components. Unfortunately, many compilation techniques for the core languages do not work across the module boundaries. As a result, few optimizing compilers support these module facilities well.This paper exploits the semantic property of ML-style modules to support efficient cross-module compilation. More specifically, we present a type-directed translation of the MacQueen-Tofte higher-order modules into a predicative variant of the polymorphic λ-calculus Fω. Because modules can be compiled in the same way as ordinary polymorphic functions, standard type-based optimizations such as representation analysis immediately carry over to the module languages.We further show that the full-transparency property of the MacQueen-Tofte system yields a near optimal cross-module compilation framework. By propagating various static information through the module boundaries, many static program analyses for the core languages can be extended to work across higher-order modules.

    References

    [1]
    A. Aiken and N. Heintze. Constraint-based program analysis. POPL'95 Tutorial, January 1995.
    [2]
    A. W. Appel. Compiling with Continuations. Cambridge University Press, 1992.
    [3]
    E. Biagioni, R. Harper, P. Lee, and B. Milnes. Signatures for a network protocol stack: A systems application of Standard ML. In 1994 A CM Conference on Lisp and Functional Pro- 9rammin9, pages 55-64, New York, June 1994. ACM Press.
    [4]
    S. K. Biswas. Higher-order functors with transparent signslures. In Twenty-second Annual A CM Syrnp. on Principles of Prog. Languages, pages 154-163, New York, jan 1995. ACM Press.
    [5]
    M. Blume and A. W. Appel. Lambda-splitting: A higherorder approach to cross-module optimizations, in Proc. 1997 A CM SIGPLAN International Conference on Functional Programming (ICFP'97), pages 112-124. ACM Press, June 1997.
    [6]
    C. Chambers. The Design and Implementation of the SELF Compiler, an Optimizing Compiler for Object-Oriented Programming Languages. PhD thesis, Stanford University, Stanford, California, March 1992.
    [7]
    J. Courant. An applicative module calculus. In M. Bidoit and M. Dauchet, editors, TAPSOFT'97: Theory and Practice of Software Development: LNCS Vol 1214, pages 622-636, New York, 1997. $pringer-Verlag.
    [8]
    L. Damns and It. Milner. Principal type-schemes for functional programs. In Ninth Annual A CM Syrup. on Principles of Prog. Languages, pages 207-212, New York, Jan 1982. ACM Press.
    [9]
    L. George. MLItlSC: Customizable and reusable code generators. Technical memorandum, AT&T Bell Laboratories, Murray Hill, NJ, 1997.
    [10]
    J. Y. Girard. Interpretation Fonctionnelle et Elimination des Coupures dans l'Arithmetique d'Ordre Superieur. PhD thesis, University of Paris VII, 1972.
    [11]
    R. Harper and M. Lillibridge. A type-theoretic approach to higher-order modules with sharing. In Twenty-first Annual A CM Syrup. on Principles of Prog. Languages, pages 123- 137, New York, Jan 1994. ACM Press.
    [12]
    R. Harper and J. C. Mitchell. On the type structure of Standard ML. A CM Trans. on Programming Languages and Systems, 15(2):211-252, April 1993.
    [13]
    R. Harper, j. C. Mitchell, and E. Moggi. Higher-order modules and the phase distinction. In Seventeenth Annual A CM Syrup. on Principles of Prog. Languages, pages 341-344, New York, Jan 1990. ACM Press.
    [14]
    R. Harper and G. Morrisett. Compiling polymorphism using intensional type analysis. In Twenty-second Annual A CM Syrup. on Principles of Prog. Languages, pages 130-141, New York, Jan 1995. ACM Press.
    [15]
    R. Harper and C. Stone. An interpretation of Standard ML in type theory. Technical Report CMU-CS-97-147, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA, June 1997.
    [16]
    M.P. Jones. Using parameterized signatures to express modular structure. In Twenty-third Annual A CM Syrup. on Principles of Prog. Languages, pages 68-78, New York, Jan 1996. ACM Press.
    [17]
    N. D. Jones. Partial evaluation. POPL'91, tutorial handout, January 1991.
    [18]
    X. Leroy. Unboxed objects and polymorphic typing. In Nineteenth Annual A CM Syrup. on Principles of Prog. Languages, pages 177-188, New York, Jan 1992. ACM Press. Longer version available as INRiA Tech Report.
    [19]
    X. Leroy. Manifest types, modules, and separate compilalion. In Twenty-first Annual A CM Syrup. on Principles of Prog. Languages, pages 109-122, New York, jan 1994. ACM Press.
    [20]
    X. Leroy. Applicative functors and fully transparent higherorder modules. In Twenty-second Annual A CM Syrup. on Principles of Prog. Languages, pages 142-153, New York, Jan 1995. ACM Press.
    [21]
    X. Leroy. A modular module system. Technical report 2866, INRIA, April 1996.
    [22]
    X. Leroy. A syntactic theory of type generativity and sharing. Journal of Functional Programming, 6(5):1-32, September 1996.
    [23]
    M. Lillibridge. Translucent Sums: A Foundation for Higher- Order Module Systems. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA, May 1997. Tech Report CMU-CS-97-122.
    [24]
    D. MacQueen. Using dependent types to express modular structure. In Proc. 13th Annual ACM SIGPLAN-SIGACT Syrup. on Principles of Programming Languages, pages 277- 286. ACM Press, 1986.
    [25]
    D. MacQueen and M. Tofte. A semantics for higher order functors. In The 5th European Symposium on Programming, pages 409-423, Berlin, April 1994. Spinger-Verlag.
    [26]
    R. MiLner, M. Torte, and R. Harper. The Definition of Standard ML. MIT Press, Cambridge, Massachusetts, 1990.
    [27]
    R. Milner, M. Torte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). MIT Press, Cambridge, Massachusetts, 1997.
    [28]
    Y. Minamide, G. Morrisett, and R. Harper. Typed closure conversion. In Proc. 23rd Annual A CM SIGPLAN-SIGA CT Syrup. on Principles of Programming Languages, pages 271- 283. ACM Press, 1996.
    [29]
    G. Morrisett. Compiling with Types. PhD thesis, School of Computer Science, Carnegie Mellon University, Pittsburgh, PA, December 1995. Tech Report CMU-CS-95-226.
    [30]
    G. Morrisett. Personal Communication, Cornell University, January 1997.
    [31]
    G. Nelson, editor. Systems programming with Modula-3. Prentice Hall, Englewood Cliffs, NJ, 1991.
    [32]
    J. C. Reynolds. Towards a theory of type structure. In Proceedings, Colloque sur la Programmation, Lecture Notes in Computer Science, volume 19, pages 408-425. Springer- Verlag, Berlin, 1974.
    [33]
    Z. Shao. Flexible representation analysis. In Proc. I997 A CM SIGPLAN international Conference on Functional Programming (ICFP'97), pages 85-98. ACM Press, June 1997.
    [34]
    Z. Shao. An overview of the FLINT/ML compiler. In Proc. 1997 ACM SIGPLAN Workshop on Types in Compilation, June 1997.
    [35]
    Z. Shao. Typed cross-module compilation. Technical Report YALEU/DCS/RR-1126, Department of Computer Science, Yale University, New Haven, CT, June 1998.
    [36]
    Z. Shao and A. W. Appel. A type-based compiler for'Standard ML. In Proc. A CM SIGPLAN 'g5 Conf. on Prog. Lang. Design and Implementation, pages 116-129. ACM Press, 1995.
    [37]
    O. Shivers. Control-Flow Analysis of Higher. Order Languages. PhD thesis, Carnegie Mellon Univ., Pittsburgh, Pennsylvania, May 1991. CMU-CS-91-145.
    [38]
    D. Tarditi, G. Morrisett, P. Cheng, C. Stone, R. Harper, and P. Lee. TIL: A type-directed optimizing compiler for ML. In Proc. A CM SIGPLAN '96 Conf. on Prog. Lang. Design and Implementation, pages 181-192. ACM Press, 1996.
    [39]
    M. Torte. Principal signatures for high-order ML functors. In Nineteenth Annual A CM Syrnp. on Principles of Prog. Languages, pages 189-199, New York, Jan 1992. ACM Press.
    [40]
    A. Tolmach. Tag-free garbage collection using explicit type parameters. In Proc. 19gd A CM Conf. on Lisp and Functional Programming, pages 1-11, New York, June 1994. ACM Press.

    Cited By

    View all

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 34, Issue 1
    Jan. 1999
    357 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/291251
    Issue’s Table of Contents
    • cover image ACM Conferences
      ICFP '98: Proceedings of the third ACM SIGPLAN international conference on Functional programming
      September 1998
      351 pages
      ISBN:1581130244
      DOI:10.1145/289423
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 29 September 1998
    Published in SIGPLAN Volume 34, Issue 1

    Check for updates

    Qualifiers

    • Article

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)35
    • Downloads (Last 6 weeks)7

    Other Metrics

    Citations

    Cited By

    View all

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Get Access

    Login options

    Media

    Figures

    Other

    Tables

    Share

    Share

    Share this Publication link

    Share on social media