skip to main content
10.1145/1291151.1291194acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
Article

Faster laziness using dynamic pointer tagging

Published:01 October 2007Publication History

ABSTRACT

In the light of evidence that Haskell programs compiled by GHC exhibit large numbers of mispredicted branches on modern processors, we re-examine the "tagless" aspect of the STG-machine that GHC uses as its evaluation model.

We propose two tagging strategies: a simple strategy called semi-tagging that seeks to avoid one common source of unpredictable indirect jumps, and a more complex strategy called dynamic pointer-tagging that uses the spare low bits in a pointer to encode information about the pointed-to object. Both of these strategies have been implemented and exhaustively measured in the context of a production compiler, GHC, and the paper contains detailed descriptions of the implementations. Our measurements demonstrate significant performance improvements (14% for dynamic pointer-tagging with only a 2% increase in code size), and we further demonstrate that much of the improvement can be attributed to the elimination of mispredicted branch instructions.

As part of our investigations we also discovered that one optimisation in the STG-machine, vectored-returns, is no longer worthwhile and we explain why.

References

  1. Urban Boquist. Code Optimisation Techniques for Lazy Functional Languages. PhD thesis, Chalmers University of Technology, April 1999. URL http://www.cs.chalmers.se/~boquist/phd/phd.ps.Google ScholarGoogle Scholar
  2. Agner Fog. The microarchitecture of Intel and AMD CPUs: An optimization guide for assembly programmers and compiler makers. online manual, 2006. http://www.agner.org/optimize/microarchitecture.pdf.Google ScholarGoogle Scholar
  3. Kevin Hammond. The spineless tagless G-machine - NOT. unpublished, 1993. citeseer.ist.psu.edu/hammond93spineless.html.Google ScholarGoogle Scholar
  4. Richard A. Kelsey and Jonathan A. Rees. A tractable scheme implementation. Lisp and Symbolic Computation, 7 (4): 315--335, 1994. http://repository.readscheme.org/ftp/papers/vlisp-lasc/scheme48.ps.gz. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. Robert A. MacLachlan. Design of CMU Common Lisp. online manual, 2003. http://common-lisp.net/project/cmucl/doc/CMUCL-design.pdf.Google ScholarGoogle Scholar
  6. Simon Marlow and Simon Peyton Jones. Making a fast curry: Push/enter vs. eval/apply for higher-order languages. In ACM SIGPLAN International Conference on Functional Programming (ICFP'04), pages 4--15, Snowbird, Utah, September 2004. ACM. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Nicholas Nethercote and Alan Mycroft. Redux: A dynamic dataflow tracer. Electr. Notes Theor. Comput. Sci., 89 (2), 2003.Google ScholarGoogle Scholar
  8. Will D. Partain. The nofib benchmark suite of Haskell programs. In John Launchbury and Patrick M. Sansom, editors, Functional Programming, Glasgow 1992, Workshops in Computing, pages 195--202. Springer Verlag, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Simon Peyton Jones, Norman Ramsey, and Fermin Reig. C--: a portable assembly language that supports garbage collection. In Gopalan Nadathur, editor, International Conference on Principles and Practice of Declarative Programming, number 1702 in Lecture Notes in Computer Science, pages 1--28, Berlin, September 1999. Springer. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. Simon L. Peyton Jones. Implementing lazy functional languages on stock hardware: The spineless tagless G-machine. Journal of Functional Programming, 2 (2): 127--202, April 1992.Google ScholarGoogle ScholarCross RefCross Ref
  11. Patrick M. Sansom and Simon L. Peyton Jones. Generational garbage collection for haskell. In Functional Programming Languages and Computer Architecture, pages 106--116, 1993. citeseer.ist.psu.edu/sansom93generational.html. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. Guy Lewis Steele. Data representation in PDP-10 MACLISP. Technical Report AI Lab Memo AIM-420, MIT AI Lab, 1977.Google ScholarGoogle Scholar

Index Terms

  1. Faster laziness using dynamic pointer tagging

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        ICFP '07: Proceedings of the 12th ACM SIGPLAN international conference on Functional programming
        October 2007
        346 pages
        ISBN:9781595938152
        DOI:10.1145/1291151
        • cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 42, Issue 9
          Proceedings of the ICFP '07 conference
          September 2007
          331 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/1291220
          Issue’s Table of Contents

        Copyright © 2007 ACM

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 1 October 2007

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • Article

        Acceptance Rates

        Overall Acceptance Rate333of1,064submissions,31%

        Upcoming Conference

        ICFP '23

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader
      About Cookies On This Site

      We use cookies to ensure that we give you the best experience on our website.

      Learn more

      Got it!