skip to main content
10.1145/2784731.2784740acmconferencesArticle/Chapter ViewAbstractPublication PagesicfpConference Proceedingsconference-collections
research-article

Pycket: a tracing JIT for a functional language

Published: 29 August 2015 Publication History

Abstract

We present Pycket, a high-performance tracing JIT compiler for Racket. Pycket supports a wide variety of the sophisticated features in Racket such as contracts, continuations, classes, structures, dynamic binding, and more. On average, over a standard suite of benchmarks, Pycket outperforms existing compilers, both Racket's JIT and other highly-optimizing Scheme compilers. Further, Pycket provides much better performance for Racket proxies than existing systems, dramatically reducing the overhead of contracts and gradual typing. We validate this claim with performance evaluation on multiple existing benchmark suites. The Pycket implementation is of independent interest as an application of the RPython meta-tracing framework (originally created for PyPy), which automatically generates tracing JIT compilers from interpreters. Prior work on meta-tracing focuses on bytecode interpreters, whereas Pycket is a high-level interpreter based on the CEK abstract machine and operates directly on abstract syntax trees. Pycket supports proper tail calls and first-class continuations. In the setting of a functional language, where recursion and higher-order functions are more prevalent than explicit loops, the most significant performance challenge for a tracing JIT is identifying which control flows constitute a loop---we discuss two strategies for identifying loops and measure their impact.

References

[1]
A. Appel and D. MacQueen. Standard ML of New Jersey. In J. Maluszy´nski and M. Wirsing, editors, Programming Language Implementation and Logic Programming, volume 528 of Lecture Notes in Computer Science, pages 1–13. Springer Berlin Heidelberg, 1991.
[2]
H. Ardö, C. F. Bolz, and M. Fijakowski. Loop-aware optimizations in PyPy’s tracing JIT. In Proceedings of the 8th Symposium on Dynamic Languages, DLS ’12, pages 63–72, New York, NY, USA, 2012. ACM. J. Aycock. A brief history of just-in-time. ACM Comput. Surv., 35(2):97–113, June 2003.
[3]
V. Bala, E. Duesterwald, and S. Banerjia. Dynamo: A transparent dynamic optimization system. In Proceedings of the ACM SIGPLAN 2000 Conference on Programming Language Design and Implementation, PLDI ’00, pages 1–12, New York, NY, USA, 2000. ACM. M. Bebenita, F. Brandner, M. Fahndrich, F. Logozzo, W. Schulte, N. Tillmann, and H. Venter. SPUR: A trace-based JIT compiler for CIL. In Proc. OOPSLA, pages 708–725, 2010.
[4]
C. F. Bolz and L. Tratt. The impact of meta-tracing on VM design and implementation. Science of Computer Programming, 2013.
[5]
C. F. Bolz, A. Cuni, M. Fijakowski, and A. Rigo. Tracing the meta-level: PyPy’s tracing JIT compiler. In Proc. ICOOOLPS, pages 18–25, 2009.
[6]
C. F. Bolz, A. Cuni, M. Fijakowski, M. Leuschel, S. Pedroni, and A. Rigo. Allocation removal by partial evaluation in a tracing JIT. Proc. PEPM, pages 43–52, 2011.
[7]
C. F. Bolz, L. Diekmann, and L. Tratt. Storage strategies for collections in dynamically typed languages. In Proc. OOPSLA, pages 167–182, 2013.
[8]
C. F. Bolz, T. Pape, J. G. Siek, and S. Tobin-Hochstadt. Meta-tracing makes a fast Racket. In Workshop on Dynamic Languages and Applications, 2014.
[9]
C. Chambers and D. Ungar. Iterative type analysis and extended message splitting: optimizing dynamically-typed object-oriented programs. Lisp Symb. Comput., 4(3):283–310, 1991.
[10]
C. Chambers, D. Ungar, and E. Lee. An efficient implementation of SELF a dynamically-typed object-oriented language based on prototypes. In Proc. OOPSLA, pages 49–70, 1989.
[11]
M. Chang, B. Mathiske, E. Smith, A. Chaudhuri, A. Gal, M. Bebenita, C. Wimmer, and M. Franz. The impact of optional type information on JIT compilation of dynamically typed languages. In Symposium on Dynamic Languages, DLS ’11, pages 13–24, 2011.
[12]
J. Clements. Portable and high-level access to the stack with Continuation Marks. PhD thesis, Citeseer, 2006.
[13]
D. Clifford, H. Payer, M. Stanton, and B. L. Titzer. Memento Mori: Dynamic allocation-site-based optimizations. In Proc. ISMM, pages 105–117. ACM, 2015. ISBN 978-1-4503-3589-8. W. D. Clinger and L. T. Hansen. Lambda, the ultimate label or a simple optimizing compiler for Scheme. In Proc. LFP, pages 128–139, 1994.
[14]
R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451490, Oct. 1991.
[15]
O. Danvy. Three steps for the CPS transformation. Technical Report CIS- 92-02, Kansas State University, 1991.
[16]
A. C. Davison and D. V. Hinkley. Bootstrap Methods and Their Application, chapter 5. Cambridge, 1997.
[17]
J. W. Demmel. Applied Numerical Linear Algebra. SIAM, 1997.
[18]
L. P. Deutsch and A. M. Schiffman. Efficient implementation of the Smalltalk-80 system. In Proc. POPL, pages 297–302, 1984.
[19]
T. Disney, C. Flanagan, and J. McCarthy. Temporal higher-order contracts. In Proceedings of the 16th ACM SIGPLAN International Conference on Functional Programming, ICFP ’11, pages 176–188, New York, NY, USA, 2011. ACM. R. K. Dybvig. Chez Scheme version 8 user’s guide. Technical report, Cadence Research Systems, 2011.
[20]
M. Feeley. Gambit-C: A portable implementation of Scheme. Technical Report v4.7.2, Universite de Montreal, February 2014.
[21]
M. Felleisen and D. P. Friedman. Control operators, the SECD-machine and the lambda-calculus. In Working Conf. on Formal Description of Programming Concepts - III, pages 193–217. Elsevier, 1987.
[22]
R. B. Findler and M. Felleisen. Contracts for higher-order functions. In International Conference on Functional Programming, ICFP, pages 48– 59, October 2002.
[23]
R. B. Findler, S.-y. Guo, and A. Rogers. Lazy contract checking for immutable data structures. In Implementation and Application of Functional Languages, pages 111–128. Springer, 2008.
[24]
C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In Proc. PLDI, pages 502–514, 1993.
[25]
M. Flatt. Composable and compilable macros: you want it when? In ICFP ’02: Proceedings of the seventh ACM SIGPLAN international conference on Functional programming, pages 72–83. ACM Press, 2002.
[26]
A. Gal and M. Franz. Incremental dynamic code generation with trace trees. Technical Report ICS-TR-06-16, University of California, Irvine, 2006.
[27]
A. Gal, C. W. Probst, and M. Franz. HotpathVM: an effective JIT compiler for resource-constrained devices. In Proc. VEE, pages 144–153, 2006.
[28]
A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. R. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendorff, J. Ruderman, E. W. Smith, R. Reitmaier, M. Bebenita, M. Chang, and M. Franz. Trace-based justin-time type specialization for dynamic languages. In Proc. PLDI, pages 465–478. ACM, 2009.
[29]
A. Gill, J. Launchbury, and S. L. Peyton Jones. A short cut to deforestation. In Proc. FPCA, pages 223–232, 1993.
[30]
M. Hölttä. Crankshafting from the ground up. Technical report, Google, August 2013.
[31]
M. N. Kedlaya, J. Roesch, B. Robatmili, M. Reshadi, and B. Hardekopf. Improved type specialization for dynamic scripting languages. In Proceedings of the 9th Symposium on Dynamic Languages, DLS ’13, pages 37–48. ACM, 2013.
[32]
J. Launchbury. A natural semantics for lazy evaluation. In Proc. POPL, pages 144–154, 1993.
[33]
S. Marr, T. Pape, and W. De Meuter. Are we there yet? Simple language implementation techniques for the 21st century. IEEE Software, 31(5): 6067, Sept. 2014.
[34]
B. Meurer. OCamlJIT 2.0 - Faster Objective Caml. CoRR, abs/1011.1783, 2010.
[35]
J. G. Mitchell. The Design and Construction of Flexible and Efficient Interactive Programming Systems. PhD thesis, Carnegie Mellon University, 1970.
[36]
M. Paleczny, C. Vick, and C. Click. The Java Hotspot server compiler. In Proc. JVM, pages 1–1. USENIX Association, 2001.
[37]
T. Schilling. Challenges for a Trace-Based Just-In-Time Compiler for Haskell. In Implementation and Application of Functional Languages, volume 7257 of LNCS, pages 51–68. 2012.
[38]
T. Schilling. Trace-based Just-in-time Compilation for Lazy Functional Programming Languages. PhD thesis, University of Kent, 2013.
[39]
M. Serrano and P. Weis. Bigloo: a portable and optimizing compiler for strict functional languages. In Static Analysis, volume 983 of LNCS, pages 366–381. 1995.
[40]
J. M. Siskind. Flow-directed lightweight closure conversion. Technical Report 99-190R, NEC Research Institute, Inc., 1999.
[41]
M. Sperber, R. K. Dybvig, M. Flatt, A. van Straaten, R. Findler, and J. Matthews. Revised 6 Report on the Algorithmic Language Scheme. Cambridge, 2010.
[42]
V. St-Amour, S. Tobin-Hochstadt, and M. Felleisen. Optimization coaching: Optimizers learn to communicate with programmers. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, OOPSLA ’12, pages 163–178, New York, NY, USA, 2012. ACM. B. Starynkevitch. OCAMLJIT – A faster just-in-time OCaml implementation. In First MetaOCaml Workshop, Oct. 20 2004.
[43]
G. L. Steele. Rabbit: A compiler for Scheme. Technical Report AI-474, MIT, 1978.
[44]
T. S. Strickland, S. Tobin-Hochstadt, R. B. Findler, and M. Flatt. Chaperones and impersonators: run-time support for reasonable interposition. In Object Oriented Programming Systems Languages and Applications, OOPSLA ’12, 2012.
[45]
G. T. Sullivan, D. L. Bruening, I. Baron, T. Garnett, and S. Amarasinghe. Dynamic native optimization of interpreters. In Proc. IVME, pages 50–57, 2003.
[46]
E. W. Thomassen. Trace-based just-in-time compiler for Haskell with RPython. Master’s thesis, Norwegian University of Science and Technology Trondheim, 2013.
[47]
S. Tobin-Hochstadt and M. Felleisen. The design and implementation of typed scheme. In Proceedings of the 35th Annual ACM SIGPLANSIGACT Symposium on Principles of Programming Languages, POPL ’08, pages 395–406, New York, NY, USA, 2008. ACM. S. Tobin-Hochstadt, V. St-Amour, R. Culpepper, M. Flatt, and M. Felleisen. Languages as libraries. In Proceedings of the 32nd ACM SIGPLAN conference on Programming language design and implementation, PLDI ’11, pages 132–141. ACM, 2011.
[48]
T. Van Cutsem and M. S. Miller. Proxies: Design principles for robust object-oriented intercession apis. In Proceedings of the 6th Symposium on Dynamic Languages, DLS ’10, pages 59–72, New York, NY, USA, 2010. ACM. P. Wadler. Deforestation: transforming programs to eliminate trees. In Proc. ESOP, pages 231–248, 1988.

Cited By

View all

Recommendations

Comments

Information & Contributors

Information

Published In

cover image ACM Conferences
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional Programming
August 2015
436 pages
ISBN:9781450336697
DOI:10.1145/2784731
  • cover image ACM SIGPLAN Notices
    ACM SIGPLAN Notices  Volume 50, Issue 9
    ICFP '15
    September 2015
    436 pages
    ISSN:0362-1340
    EISSN:1558-1160
    DOI:10.1145/2858949
    • Editor:
    • Andy Gill
    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 the author(s) 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: 29 August 2015

Permissions

Request permissions for this article.

Check for updates

Author Tags

  1. JIT compilers
  2. Racket
  3. contracts
  4. functional languages
  5. tracing

Qualifiers

  • Research-article

Funding Sources

Conference

ICFP'15
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)35
  • Downloads (Last 6 weeks)8
Reflects downloads up to 08 Mar 2025

Other Metrics

Citations

Cited By

View all
  • (2024)Static Blame for gradual typingJournal of Functional Programming10.1017/S095679682400002934Online publication date: 25-Mar-2024
  • (2023)How Profilers Can Help Navigate Type MigrationProceedings of the ACM on Programming Languages10.1145/36228177:OOPSLA2(544-573)Online publication date: 16-Oct-2023
  • (2021)ForerunnerProceedings of the ACM SIGOPS 28th Symposium on Operating Systems Principles10.1145/3477132.3483564(570-587)Online publication date: 26-Oct-2021
  • (2021)Of JavaScript AOT compilation performanceProceedings of the ACM on Programming Languages10.1145/34735755:ICFP(1-30)Online publication date: 19-Aug-2021
  • (2021)Naïve transient cast insertion isn't (that) badProceedings of the 16th ACM International Workshop on Implementation, Compilation, Optimization of OO Languages, Programs and Systems10.1145/3464972.3472395(1-9)Online publication date: 13-Jul-2021
  • (2020)Amalgamating different JIT compilations in a meta-tracing JIT compiler frameworkProceedings of the 16th ACM SIGPLAN International Symposium on Dynamic Languages10.1145/3426422.3426977(1-15)Online publication date: 17-Nov-2020
  • (2019)BacCamlCompanion Proceedings of the 3rd International Conference on the Art, Science, and Engineering of Programming10.1145/3328433.3328466(1-3)Online publication date: 1-Apr-2019
  • (2019)Extending a meta-tracing compiler to mix method and tracing compilationCompanion Proceedings of the 3rd International Conference on the Art, Science, and Engineering of Programming10.1145/3328433.3328439(1-3)Online publication date: 1-Apr-2019
  • (2018)Building JIT compilers for dynamic languages with low development effortProceedings of the 10th ACM SIGPLAN International Workshop on Virtual Machines and Intermediate Languages10.1145/3281287.3281294(36-46)Online publication date: 4-Nov-2018
  • (2018)Specializing a meta-interpreterProceedings of the 15th International Conference on Managed Languages & Runtimes10.1145/3237009.3237018(1-14)Online publication date: 12-Sep-2018
  • 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