Abstract
One of the nice properties of a tracing just-in-time compiler (JIT) is that many of its optimizations are simple, requiring one forward pass only. This is not true for loop-invariant code motion which is a very important optimization for code with tight kernels. Especially for dynamic languages that typically perform quite a lot of loop invariant type checking, boxed value unwrapping and virtual method lookups. In this paper we explain a scheme pioneered within the context of the LuaJIT project for making basic optimizations loop-aware by using a simple pre-processing step on the trace without changing the optimizations themselves.
We have implemented the scheme in RPython's tracing JIT compiler. PyPy's Python JIT executing simple numerical kernels can become up to two times faster, bringing the performance into the ballpark of static language compilers.
- F. Allen and J. Cocke. A catalogue of optimizing transformations. In R. Rustin, editor, Design and Optimization of Compilers, pages 1--30. Prentice-Hall, 1971.Google Scholar
- D. Ancona, M. Ancona, A. Cuni, and N. D. Matsakis. RPython: a step towards reconciling dynamically and statically typed OO languages. In DLS, Montreal, Quebec, Canada, 2007. ACM. Google Scholar
Digital Library
- M. Bebenita, F. Brandner, M. Fahndrich, F. Logozzo, W. Schulte, N. Tillmann, and H. Venter. SPUR: a trace-based JIT compiler for CIL. In OOPSLA, Reno/Tahoe, Nevada, USA, 2010. ACM. Google Scholar
Digital Library
- C. F. Bolz, A. Cuni, M. FijaBkowski, M. Leuschel, S. Pedroni, and A. Rigo. Allocation removal by partial evaluation in a tracing JIT. In PEPM, Austin, Texas, USA, 2011. Google Scholar
Digital Library
- C. F. Bolz, A. Cuni, M. FijaBkowski, M. Leuschel, A. Rigo, and S. Pedroni. Runtime feedback in a meta-tracing JIT for efficient dynamic languages. In ICOOOLPS, Lancaster, UK, 2011. ACM. Google Scholar
Digital Library
- C. F. Bolz, A. Cuni, M. FijaBkowski, and A. Rigo. Tracing the meta-level: PyPy's tracing JIT compiler. In ICOOOLPS, pages 18--25, Genova, Italy, 2009. ACM. Google Scholar
Digital Library
- C. F. Bolz, M. Leuschel, and D. Schneider. Towards a jitting VM for Prolog execution. In PPDP, Hagenberg, Austria, 2010. ACM. Google Scholar
Digital Library
- F. Chow, S. Chan, R. Kennedy, S.-M. Liu, R. Lo, and P. Tu. A new algorithm for partial redundancy elimination based on SSA form. In Proceedings of the ACM SIGPLAN 1997 conference on Programming language design and implementation, PLDI '97, page 273--286, New York, NY, USA, 1997. ACM. Google Scholar
Digital Library
- F. C.-T. Chow. A portable machine-independent global optimizer--design and measurements. PhD thesis, Stanford University, Stanford, CA, USA, 1984. AAI8408268. Google Scholar
Digital Library
- D. M. Dhamdhere. Practical adaption of the global optimization algorithm of Morel and Renvoise. ACM Trans. Program. Lang. Syst., 13(2):291--294, Apr. 1991. Google Scholar
Digital Library
- A. Diwan, K. S. McKinley, and J. E. B. Moss. Type-based alias analysis. SIGPLAN Not., 33(5):106--117, May 1998. 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 just-in-time type specialization for dynamic languages. In PLDI, PLDI '09, New York, New York, 2009. ACM. ACM ID: 1542528. Google Scholar
Digital Library
- A. Gal and M. Franz. Incremental dynamic code generation with trace trees. Technical Report ICS-TR-06--16, Donald Bren School of Information and Computer Science, University of California, Irvine, Nov. 2006.Google Scholar
- A. Gal, C. W. Probst, and M. Franz. HotpathVM: an effective JIT compiler for resource-constrained devices. In VEE, Ottawa, Ontario, Canada, 2006. ACM. Google Scholar
Digital Library
- J. Knoop, O. Rüthing, and B. Steffen. Lazy code motion. SIGPLAN Not., 27(7):224--234, July 1992. Google Scholar
Digital Library
- T. Kotzmann and H. Mössenböck. Escape analysis in the context of dynamic compilation and deoptimization. In Proceedings of the 1st ACM/USENIX international conference on Virtual execution environments, VEE '05, page 111--120, New York, NY, USA, 2005. ACM. ACM ID: 1064996. Google Scholar
Digital Library
- E. Morel and C. Renvoise. Global optimization by suppression of partial redundancies. Commun. ACM, 22(2):96--103, Feb. 1979. Google Scholar
Digital Library
- S. S. Muchnick and Muchnick. Advanced Compiler Design and Implementation. Morgan Kaufmann, Sept. 1997. Google Scholar
Digital Library
- M. Pall. LuaJIT 2.0 intellectual property disclosure and research opportunities, Nov. 2009.texttthttp://lua-users.org/lists/lua-l/2009--11/ msg00089.html.Google Scholar
- A. Rigo and S. Pedroni. PyPy's approach to virtual machine construction. In DLS, Portland, Oregon, USA, 2006. ACM. Google Scholar
Digital Library
Index Terms
Loop-aware optimizations in PyPy's tracing JIT
Recommendations
Vectorization in PyPy's Tracing Just-In-Time Compiler
SCOPES '16: Proceedings of the 19th International Workshop on Software and Compilers for Embedded SystemsPyPy is a widely known virtual machine for the Python programming language. PyPy itself is implemented in the statically typed subset of Python called RPython. RPython includes a tracing Just-In-Time (JIT) compiler and is capable of generating the ...
Loop-aware optimizations in PyPy's tracing JIT
DLS '12: Proceedings of the 8th symposium on Dynamic languagesOne of the nice properties of a tracing just-in-time compiler (JIT) is that many of its optimizations are simple, requiring one forward pass only. This is not true for loop-invariant code motion which is a very important optimization for code with tight ...
Runtime feedback in a meta-tracing JIT for efficient dynamic languages
ICOOOLPS '11: Proceedings of the 6th Workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and SystemsMeta-tracing JIT compilers can be applied to a variety of different languages without explicitly encoding language semantics into the compiler. So far, they lacked a way to give the language implementor control over runtime feedback. This restricted ...







Comments