Skip to main content

Optimal type lifting

  • Conference paper
  • First Online:
Types in Compilation (TIC 1998)

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1473))

Included in the following conference series:

Abstract

Modern compilers for ML-like polymorphic languages have used explicit run-time type passing to support advanced optimizations such as intensional type analysis, representation analysis and tagless garbage collection. Unfortunately, maintaining type information at run time can incur a large overhead to the time and space usage of a program. In this paper, we present an optimal type-lifting algorithm that lifts all type applications in a program to the top level. Our algorithm eliminates all run-time type constructions within any core-language functions. In fact, it guarantees that the number of types built at run time is strictly a static constant. We present our algorithm as a type-preserving source-to-source transformation and show how to extend it to handle the entire SML’97 with higher-order modules.

This research was sponsored in part by the DARPA ITO under the title “Software Evolution using HOT Language Technology”, DARPA Order No. D888, issued under Contract No. F30602-96-2-0232, and in part by an NSF CAREER Award CCR-9501624, and NSF Grant CCR-9633390. The views and conclusions contained in this document are those of the authors and should not be interpreted as representing the official policies, either expressed or implied, of the Defense Advanced Research Projects Agency or the U.S. Government.

This is a preview of subscription content, log in via an institution to check access.

Access this chapter

Institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. A. V. Aho, R. Sethi, and J. D. Ullman. Compilers: Principles, Techniques, and Tools. Addison-Wesley, Reading, MA, 1986.

    Google Scholar 

  2. A. W. Appel. Compiling with Continuations. Cambridge University Press, 1992.

    Google Scholar 

  3. N. de Bruijn. A survey of the project AUTOMATH. In To H. B. Curry: Essays on Combinatory Logic, Lambda Calculus and Formalism, pages 579–606. Edited by J. P. Seldin and J. R. Hindley, Academic Press, 1980.

    Google Scholar 

  4. C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In Proc. ACM SIGPLAN ’93 Conf. on Prog. Lang. Design and Implementation, pages 237–247, New York, June 1993. ACM Press.

    Google Scholar 

  5. J. Y. Girard. Interpretation Fonctionnelle et Elimination des Coupures dans l’Arithmetique d’Ordre Superieur. PhD thesis, University of Paris VII, 1972.

    Google Scholar 

  6. R. Harper and J. C. Mitchell. On the type structure of Standard ML. ACM Trans. Prog. Lang. Syst., 15(2): 211–252, April 1993.

    Article  Google Scholar 

  7. R. Harper and G. Morrisett. Compiling polymorphism using intensional type analysis. In Twenty-second Annual ACM Symp. on Principles of Prog. Languages, pages 130–141, New York, Jan 1995. ACM Press.

    Google Scholar 

  8. P. Hudak, S. P. Jones, and P. W. et al. Report on the programming language Haskell, a non-strict, purely functional language version 1.2. SIGPLAN Notices, 21(5), May 1992.

    Google Scholar 

  9. R. Hughes. The design and implementation of programming languages. PhD thesis, Programming Research Group, Oxford University, Oxford, UK, 1983.

    Google Scholar 

  10. T. Johnsson. Lambda Lifting: Transforming Programs to Recursive Equations. In The Second International Conference on Functional Programming Languages and Computer Architecture, pages 190–203, New York, September 1985. Springer-Verlag.

    Google Scholar 

  11. M. P. Jones. Qualified Types: Theory and Practice. PhD thesis, Oxford University Computing Laboratory, Oxford, July 1992. Technical Monograph PRG-106.

    Google Scholar 

  12. M. P. Jones. A theory of qualified types. In The 4th European Symposium on Programming, pages 287–306, Berlin, February 1992. Spinger-Verlag.

    Google Scholar 

  13. M. P. Jones. Dictionary-free overloading by partial evaluation. In Proceedings of the ACM SIGPLAN Workshop on Partial Evaluation and Semantics-Based Program Manipulation, pages 107–117. University of Melbourne TR 94/9, June 1994.

    Google Scholar 

  14. X. Leroy. Unboxed objects and polymorphic typing. In Nineteenth Annual ACM Symp. on Principles of Prog. Languages, pages 177–188, New York, Jan 1992. ACM Press. Longer version available as INRIA Tech Report.

    Google Scholar 

  15. X. Leroy and M. Mauny. Dynamics in ML. In The Fifth International Conference on Functional Programming Languages and Computer Architecture, pages 406–426, New York, August 1991. Springer-Verlag.

    Google Scholar 

  16. R. Milner, M. Tofte, and R. Harper. The Definition of Standard ML. MIT Press, Cambridge, Massachusetts, 1990.

    Google Scholar 

  17. R. Milner, M. Tofte, R. Harper, and D. MacQueen. The Definition of Standard ML (Revised). MIT Press, Cambridge, Massachusetts, 1997.

    Google Scholar 

  18. Y. Minamide. Full lifting of type parameters. Technical report, RIMS, Kyoto University, 1997.

    Google Scholar 

  19. R. Morrison, A. Dearie, R. C. H. Connor, and A. L. Brown. An ad hoc approach to the implementation of polymorphism. ACM Trans. Prog. Lang. Syst., 13(3), July 1991.

    Google Scholar 

  20. G. Nadathur. A notation for lambda terms II: Refinements and applications. Technical Report CS-1994-01, Duke University, Durham, NC, January 1994.

    Google Scholar 

  21. A. Ohori. A compilation method for ML-style polymorphic record calculi. In Nineteenth Annual ACM Symp. on Principles of Prog. Languages, New York, Jan 1992. ACM Press.

    Google Scholar 

  22. S. Peyton Jones. Implementing lazy functional languages on stock hardware: the Spineless Tagless G-machine. Journal of Functional Programming, 2(2): 127–202, April 1992.

    Article  Google Scholar 

  23. S. Peyton Jones. Compiling haskell by program transformation: a report from trenches. In Proceedings of the European Symposium on Programming, Linkoping, April 1996.

    Google Scholar 

  24. S. Peyton Jones and D. Lester. A modular fully-lazy lambda lifter in haskell. Software — Practice and Experience, 21: 479–506, 1991.

    Google Scholar 

  25. S. Peyton Jones, W. Partain, and A. Santos. Let-floating: moving bindings to give faster programs. In Proc. International Conference on Functional Programming (ICFP’96), New York, June 1996. ACM Press.

    Google Scholar 

  26. 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.

    Google Scholar 

  27. Z. Shao. Flexible representation analysis. In Proc. 1997 ACM SIGPLAN International Conference on Functional Programming (ICFP’97), pages 85–98. ACM Press, June 1997.

    Google Scholar 

  28. Z. Shao. An overview of the FLINT/ML compiler. In Proc. 1997 ACM SIGPLAN Workshop on Types in Compilation, June 1997.

    Google Scholar 

  29. Z. Shao. Typed cross-module compilation. Technical Report YALEU/DCS/RR-1126, Dept. of Computer Science, Yale University, New Haven, CT, November 1997.

    Google Scholar 

  30. Z. Shao and A. W. Appel. A type-based compiler for Standard ML. In Proc. ACM SIGPLAN ’95 Conf. on Prog. Lang. Design and Implementation, pages 116–129. ACM Press, 1995.

    Google Scholar 

  31. D. Tarditi, G. Morrisett, P. Cheng, C. Stone, R. Harper, and P. Lee. TIL: A type-directed optimizing compiler for ML. In Proc. ACM SIGPLAN ’96 Conf. on Prog. Lang. Design and Implementation, pages 181–192. ACM Press, 1996.

    Google Scholar 

  32. A. Tolmach. Tag-free garbage collection using explicit type parameters. In Proc. 1994 ACM Conf. on Lisp and Functional Programming, pages 1–11, New York, June 1994. ACM Press.

    Google Scholar 

  33. A. K. Wright. Polymorphism for imperative languages without imperative types. Technical Report Tech Report TR 93-200, Dept. of Computer Science, Rice University, Houston, Texas, February 1993.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Xavier Leroy Atsushi Ohori

Rights and permissions

Reprints and permissions

Copyright information

© 1998 Springer-Verlag Berlin Heidelberg

About this paper

Cite this paper

Saha, B., Shao, Z. (1998). Optimal type lifting. In: Leroy, X., Ohori, A. (eds) Types in Compilation. TIC 1998. Lecture Notes in Computer Science, vol 1473. Springer, Berlin, Heidelberg. https://doi.org/10.1007/BFb0055517

Download citation

  • DOI: https://doi.org/10.1007/BFb0055517

  • Published:

  • Publisher Name: Springer, Berlin, Heidelberg

  • Print ISBN: 978-3-540-64925-0

  • Online ISBN: 978-3-540-68308-7

  • eBook Packages: Springer Book Archive

Publish with us

Policies and ethics