Representation Analysis for Coercion Placement

  • Karl-Filip Faxén
Conference paper
Part of the Lecture Notes in Computer Science book series (LNCS, volume 2477)


This paper presents a global approach to representation analysis based on program-wide data and control flow information. Boxing and unboxing coercions can be placed around any variable occurrence, not only where values are produced and consumed.

The analysis first constructs a graph representing all legal coercion placements, then selects one of them. Assigning unboxed representations to as many variables as possible does not necessarily minimize execution time (or the number of executed coercions); we present and measure several heuristics.

When combined with function cloning, the analysis is powerful enough to eliminate almost all coercions from several nonstrict programs, including a simple polymorphic type checker.


Black Hole Representation Analysis Sink Node High Order Function Case Expression 
These keywords were added by machine and not by the authors. This process is experimental and the keywords may be updated as the learning algorithm improves.


Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.


  1. 1.
    Urban Boquist. Code Optimization Techniques for Lazy Functional Languages. PhD thesis, Chalmers University of Technology, April 1999.Google Scholar
  2. 2.
    Allyn Dimock, Robert Muller, Franklyn Turbak, and J. B. Wells. Strongly typed flow-directed representation transformations. ACM SIGPLAN Notices, 32(8), August 1997.Google Scholar
  3. 3.
    Karl-Filip Faxén. Optimizing lazy functional programs using flow inference. In Allan Mycroft, editor, Proceedings of the Second International Symposium on Static Analysis, pages 136–153, Glasgow, UK, September 1995. Springer-Verlag.Google Scholar
  4. 4.
    Karl-Filip Faxén. Analysing, Transforming and Compiling Lazy Functional Programs. PhD thesis, Department of Teleinformatics, Royal Institute of Technology, June 1997.Google Scholar
  5. 5.
    Karl-Filip Faxén. Cheap eagerness: Speculative evaluation in a lazy functional language. In Philip Wadler, editor, Proceedings of the 2000 International Conference on Functional Programming, September 2000.Google Scholar
  6. 6.
    Karl-Filip Faxén. The costs and benefits of cloning in a lazy functional language. In Stephen Gilmore, editor, Trends in Functional Programming, volume 2, pages 1–12. Intellect, 2001. Proc. of Scottish Functional Programming Workshop, 2000.Google Scholar
  7. 7.
    Cordelia V. Hall, Simon L. Peyton Jones, and Patrick M. Sansom. Unboxing using specialisation. In Glasgow functional programming workshop. Springer Verlag, July 1994.Google Scholar
  8. 8.
    Robert Harper and Greg Morrisett. Compiling polymorphism using intensional type analysis. In Principles of Programming Languages, San Francisco, January 1995.Google Scholar
  9. 9.
    Pieter Hartel and Koen Langendoen. Benchmarking implementations of lazy functional languages. In Functional Programming & Computer Architecture, pages 341–349, Copenhagen, June 93.Google Scholar
  10. 10.
    Fritz Henglein. Global tagging optimization by type inference. In Proc. 1992 ACM Conf. on LISP and Functional Programming (LFP), San Francisco, California, pages 205–215. ACM, ACM Press, June 1992.Google Scholar
  11. 11.
    Fritz Henglein and Jesper Jørgensen. Formally optimal boxing. In Conference Record of POPL’ 94: 21st ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 213–226, Portland, Oregon, January 1994.Google Scholar
  12. 12.
    Xavier Leroy. Unboxed objects and polymorphic typing. In Conference Record of the Nineteenth Annual ACM SIGPLAN-SIGACT Symposium on Principles of Programming Languages, pages 177–188, Albequerque, New Mexico, January 1992.Google Scholar
  13. 13.
    Yasuhiko Minamide and Jacques Garrigue. On the runtime complexity of typedirected unboxing. In Proc. International Conference on Functional Programming, pages 1–12. ACM Press, September 1998.Google Scholar
  14. 14.
    Christian Mossin. Flow Analysis of Typed Higher-Order Programs. PhD thesis, DIKU, University of Copenhagen, Denmark, January 1997.zbMATHGoogle Scholar
  15. 15.
    John Peterson. Untagged data in tagged environments: Choosing optimal representations at compile time. In Proceedings of the Fourth International Conference on Functional Programming Languages and Computer Architecture, pages 89–99. ACM Press, September 1989.Google Scholar
  16. 16.
    Simon L Peyton Jones and André Santos. A transformation-based optimizer for Haskell. Science of Computer Programming, 32(1–3):3–47, September 1998.Google Scholar
  17. 17.
    Manuel Serrano and Marc Feeley. Storage use analysis and its applications. ACM SIGPLAN Notices, 31(6):50–61, June 1996.Google Scholar
  18. 18.
    Zhong Shao. Flexible representation analysis. ACM SIGPLAN Notices, 32(8):85–98, August 1997.Google Scholar
  19. 19.
    Zhong Shao and Andrew W. Appel. A type-based compiler for Standard ML. In Programming Language Design and Implementation, pages 116–129, La Jolla, CA, June 1995. ACM Press.Google Scholar
  20. 20.
    Stephen T. Weeks. MLton user’s guide. Available from, September 2000.

Copyright information

© Springer-Verlag Berlin Heidelberg 2002

Authors and Affiliations

  • Karl-Filip Faxén
    • 1
  1. 1.Dept. of Microelectronics and Information TechnologyRoyal Institute of TechnologyKista

Personalised recommendations