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

Faster laziness using dynamic pointer tagging

Published: 01 October 2007 Publication 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.
[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.
[3]
Kevin Hammond. The spineless tagless G-machine - NOT. unpublished, 1993. citeseer.ist.psu.edu/hammond93spineless.html.
[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.
[5]
Robert A. MacLachlan. Design of CMU Common Lisp. online manual, 2003. http://common-lisp.net/project/cmucl/doc/CMUCL-design.pdf.
[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.
[7]
Nicholas Nethercote and Alan Mycroft. Redux: A dynamic dataflow tracer. Electr. Notes Theor. Comput. Sci., 89 (2), 2003.
[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.
[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.
[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.
[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.
[12]
Guy Lewis Steele. Data representation in PDP-10 MACLISP. Technical Report AI Lab Memo AIM-420, MIT AI Lab, 1977.

Cited By

View all
  • (2024)Realistic Realizability: Specifying ABIs You Can Count OnProceedings of the ACM on Programming Languages10.1145/36897558:OOPSLA2(1249-1278)Online publication date: 8-Oct-2024
  • (2020)Alligator collector: a latency-optimized garbage collector for functional programming languagesProceedings of the 2020 ACM SIGPLAN International Symposium on Memory Management10.1145/3381898.3397214(87-99)Online publication date: 16-Jun-2020
  • (2019)Leveraging hardware TM in HaskellProceedings of the 24th Symposium on Principles and Practice of Parallel Programming10.1145/3293883.3295711(94-106)Online publication date: 16-Feb-2019
  • Show More Cited By

Recommendations

Comments

Information & Contributors

Information

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
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]

Sponsors

Publisher

Association for Computing Machinery

New York, NY, United States

Publication History

Published: 01 October 2007

Permissions

Request permissions for this article.

Check for updates

Qualifiers

  • Article

Conference

ICFP07
Sponsor:

Acceptance Rates

Overall Acceptance Rate 333 of 1,064 submissions, 31%

Upcoming Conference

ICFP '25
ACM SIGPLAN International Conference on Functional Programming
October 12 - 18, 2025
Singapore , Singapore

Contributors

Other Metrics

Bibliometrics & Citations

Bibliometrics

Article Metrics

  • Downloads (Last 12 months)8
  • Downloads (Last 6 weeks)2
Reflects downloads up to 08 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Realistic Realizability: Specifying ABIs You Can Count OnProceedings of the ACM on Programming Languages10.1145/36897558:OOPSLA2(1249-1278)Online publication date: 8-Oct-2024
  • (2020)Alligator collector: a latency-optimized garbage collector for functional programming languagesProceedings of the 2020 ACM SIGPLAN International Symposium on Memory Management10.1145/3381898.3397214(87-99)Online publication date: 16-Jun-2020
  • (2019)Leveraging hardware TM in HaskellProceedings of the 24th Symposium on Principles and Practice of Parallel Programming10.1145/3293883.3295711(94-106)Online publication date: 16-Feb-2019
  • (2016)Polymorphic type inference for machine codeACM SIGPLAN Notices10.1145/2980983.290811951:6(27-41)Online publication date: 2-Jun-2016
  • (2016)Polymorphic type inference for machine codeProceedings of the 37th ACM SIGPLAN Conference on Programming Language Design and Implementation10.1145/2908080.2908119(27-41)Online publication date: 2-Jun-2016
  • (2016)Translingual Obfuscation2016 IEEE European Symposium on Security and Privacy (EuroS&P)10.1109/EuroSP.2016.21(128-144)Online publication date: Mar-2016
  • (2014)Towards native higher-order remote procedure callsProceedings of the 26nd 2014 International Symposium on Implementation and Application of Functional Languages10.1145/2746325.2746332(1-12)Online publication date: 1-Oct-2014
  • (2014)Krivine netsACM SIGPLAN Notices10.1145/2692915.262815249:9(349-361)Online publication date: 19-Aug-2014
  • (2014)An efficient representation for lazy constructors using 64-bit pointersProceedings of the 3rd ACM SIGPLAN workshop on Functional high-performance computing10.1145/2636228.2636232(23-30)Online publication date: 3-Sep-2014
  • (2014)Krivine netsProceedings of the 19th ACM SIGPLAN international conference on Functional programming10.1145/2628136.2628152(349-361)Online publication date: 19-Aug-2014
  • Show More Cited By

View Options

Login options

View options

PDF

View or Download as a PDF file.

PDF

eReader

View online with eReader.

eReader

Figures

Tables

Media

Share

Share

Share this Publication link

Share on social media