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.
- 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.Google Scholar
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- C. F. Bolz and L. Tratt. The impact of meta-tracing on VM design and implementation. Science of Computer Programming, 2013.Google Scholar
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- C. F. Bolz, L. Diekmann, and L. Tratt. Storage strategies for collections in dynamically typed languages. In Proc. OOPSLA, pages 167–182, 2013. Google Scholar
Digital Library
- 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.Google Scholar
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- J. Clements. Portable and high-level access to the stack with Continuation Marks. PhD thesis, Citeseer, 2006.Google Scholar
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- O. Danvy. Three steps for the CPS transformation. Technical Report CIS- 92-02, Kansas State University, 1991.Google Scholar
- A. C. Davison and D. V. Hinkley. Bootstrap Methods and Their Application, chapter 5. Cambridge, 1997.Google Scholar
Cross Ref
- J. W. Demmel. Applied Numerical Linear Algebra. SIAM, 1997. Google Scholar
Digital Library
- L. P. Deutsch and A. M. Schiffman. Efficient implementation of the Smalltalk-80 system. In Proc. POPL, pages 297–302, 1984. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- M. Feeley. Gambit-C: A portable implementation of Scheme. Technical Report v4.7.2, Universite de Montreal, February 2014.Google Scholar
- 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.Google Scholar
- R. B. Findler and M. Felleisen. Contracts for higher-order functions. In International Conference on Functional Programming, ICFP, pages 48– 59, October 2002. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- C. Flanagan, A. Sabry, B. F. Duba, and M. Felleisen. The essence of compiling with continuations. In Proc. PLDI, pages 502–514, 1993. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- A. Gal and M. Franz. Incremental dynamic code generation with trace trees. Technical Report ICS-TR-06-16, University of California, Irvine, 2006.Google Scholar
- A. Gal, C. W. Probst, and M. Franz. HotpathVM: an effective JIT compiler for resource-constrained devices. In Proc. VEE, pages 144–153, 2006. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- A. Gill, J. Launchbury, and S. L. Peyton Jones. A short cut to deforestation. In Proc. FPCA, pages 223–232, 1993. Google Scholar
Digital Library
- M. Hölttä. Crankshafting from the ground up. Technical report, Google, August 2013.Google Scholar
- 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. Google Scholar
Digital Library
- J. Launchbury. A natural semantics for lazy evaluation. In Proc. POPL, pages 144–154, 1993. Google Scholar
Digital Library
- 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.Google Scholar
Cross Ref
- B. Meurer. OCamlJIT 2.0 - Faster Objective Caml. CoRR, abs/1011.1783, 2010.Google Scholar
- J. G. Mitchell. The Design and Construction of Flexible and Efficient Interactive Programming Systems. PhD thesis, Carnegie Mellon University, 1970. Google Scholar
Digital Library
- M. Paleczny, C. Vick, and C. Click. The Java Hotspot server compiler. In Proc. JVM, pages 1–1. USENIX Association, 2001. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- T. Schilling. Trace-based Just-in-time Compilation for Lazy Functional Programming Languages. PhD thesis, University of Kent, 2013.Google Scholar
- 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. Google Scholar
Digital Library
- J. M. Siskind. Flow-directed lightweight closure conversion. Technical Report 99-190R, NEC Research Institute, Inc., 1999.Google Scholar
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- G. L. Steele. Rabbit: A compiler for Scheme. Technical Report AI-474, MIT, 1978. Google Scholar
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
- E. W. Thomassen. Trace-based just-in-time compiler for Haskell with RPython. Master’s thesis, Norwegian University of Science and Technology Trondheim, 2013.Google Scholar
- 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. Google Scholar
Digital Library
- 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. Google Scholar
Digital Library
Index Terms
Pycket: a tracing JIT for a functional language
Recommendations
Pycket: a tracing JIT for a functional language
ICFP 2015: Proceedings of the 20th ACM SIGPLAN International Conference on Functional ProgrammingWe 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 ...
Amalgamating different JIT compilations in a meta-tracing JIT compiler framework
DLS 2020: Proceedings of the 16th ACM SIGPLAN International Symposium on Dynamic LanguagesMost virtual machines employ just-in-time (JIT) compilers to achieve high-performance. Trace-based compilation and method-based compilation are two major compilation strategies in JIT compilers. In general, the former excels in compiling programs with ...
Interpreter-guided differential JIT compiler unit testing
PLDI 2022: Proceedings of the 43rd ACM SIGPLAN International Conference on Programming Language Design and ImplementationModern language implementations using Virtual Machines feature diverse execution engines such as byte-code interpreters and machine-code dynamic translators, a.k.a. JIT compilers. Validating such engines requires not only validating each in isolation, ...






Comments