Tracing the meta-level: PyPy's tracing JIT compiler

@inproceedings{BolzTereick2009TracingTM,
  title={Tracing the meta-level: PyPy's tracing JIT compiler},
  author={Carl Friedrich Bolz-Tereick and Antonio Cuni and Maciej Fijalkowski and Armin Rigo},
  booktitle={ICOOOLPS@ECOOP},
  year={2009}
}
We attempt to apply the technique of Tracing JIT Compilers in the context of the PyPy project, i.e., to programs that are interpreters for some dynamic languages, including Python. Tracing JIT compilers can greatly speed up programs that spend most of their time in loops in which they take similar code paths. However, applying an unmodified tracing JIT to a program that is itself a bytecode interpreter results in very limited or no speedup. In this paper we show how to guide tracing JIT… 

Figures from this paper

Meta-tracing makes a fast Racket
TLDR
The result of spending just a couple person-months implementing and tuning an implementation of Racket written in RPython is presented, with a geometric mean equal to Racket’s performance and within a factor of 2 slower than Gambit and Larceny on a collection of standard Scheme benchmarks.
Loop-aware optimizations in PyPy's tracing JIT
TLDR
This paper explains 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, and implements it in RPython's tracing JIT compiler.
A Tracing JIT Compiler for Erlang using LLVM
TLDR
The Erlang runtime is modified to add support for a tracing just-in-time (JIT) compiler, similar to Mozilla’s TraceMonkey, which makes use of the LLVM compiler library to optimize and emit native code.
A formal foundation for trace-based JIT compilers
TLDR
This work proposes a formal framework that facilitates the design and implementation of a tracing JIT compiler and its accompanying dynamic analyses by decoupling the tracing, optimization, and interpretation processes.
SPUR: a trace-based JIT compiler for CIL
TLDR
A TJIT for Microsoft's Common Intermediate Language CIL is designed and implemented that enables TJIT optimizations for any program compiled to this platform and provides a performance evaluation of the JavaScript runtime which translates JavaScript to CIL and then runs on top of the CIL TJIT.
Vectorization in PyPy's Tracing Just-In-Time Compiler
TLDR
The empirical evaluation shows that the vectorizer of PyPy can gain speedups close to the theoretical optimum of the SSE4 instruction set.
Surgical precision JIT compilers
TLDR
This paper presents Lancet, a JIT compiler framework for Java bytecode that enables such a tight, two-way integration with the running program and proposes to turn JIT compilation into a precision tool by adding two essential and generic metaprogramming facilities.
Threaded Code Generation with a Meta-tracing JIT Compiler
TLDR
A meta-hybrid JIT compiler framework to take advantages of the two strategies as a language implementation framework and to use it for further speed-up by preventing the path-divergence problem, which causes serious slowdown.
Extending a meta-tracing compiler to mix method and tracing compilation
TLDR
This paper proposes an approach to enable both tracing- and method-based compilation so that the runtime can selectively apply an appropriate strategy to different parts of a program.
Trace-based compilation for the Java HotSpot virtual machine
TLDR
This paper presents the implementation of a trace-based JIT compiler in which the mature, method-based Java HotSpot client compiler is modified and a bytecode preprocessing step is added that detects and directly marks loops within the bytecodes to simplify trace recording.
...
...

References

SHOWING 1-10 OF 26 REFERENCES
Dynamic native optimization of interpreters
TLDR
This paper presents an innovative approach that dynamically removes much of the interpreted overhead from language implementations, with minimal instrumentation of the original interpreter.
Faster than C#: efficient implementation of dynamic languages on .NET
TLDR
The main and novel contribution of this paper is to show that this two-layers JIT technique is effective, since programs written in dynamic languages can run on .NET as fast as (and in some cases even faster than) the equivalent C# programs.
Trace-based just-in-time type specialization for dynamic languages
TLDR
This work presents an alternative compilation technique for dynamically-typed languages that identifies frequently executed loop traces at run-time and then generates machine code on the fly that is specialized for the actual dynamic types occurring on each path through the loop.
Automatic JIT Compiler Generation with Runtime Partial Evaluation
TLDR
This thesis wrote a Prolog prototype that performs partial evaluation at runtime for interpreters written in Prolog and solves some problems of classical partial evaluation and makes it at the same time applicable to dynamic languages.
PyPy's approach to virtual machine construction
The PyPy project seeks to prove both on a research and a practical level the feasibility of constructing a virtual machine (VM) for a dynamic language in a dynamic language - in this case, Python.
Optimizing direct threaded code by selective inlining
TLDR
It is demonstrated that a few simple techniques make it possible to create highly-portable dynamic translators that can attain as much as 70% the performance of optimized C for certain numerical computations.
Efficient Just-InTime Execution of Dynamically Typed Languages Via Code Specialization Using Precise Runtime Type Inference
TLDR
This work presents a new approach to compiling dynamically typed languages in which code traces observed during execution are dynamically specialized for each actually observed run-time type.
Tracing for web 3.0: trace compilation for the next generation web applications
TLDR
A trace-based just-in-time compiler for JavaScript that uses run-time profiling to identify frequently executed code paths, which are compiled to executable machine code.
Incremental Dynamic Code Generation with Trace Trees
TLDR
This work explores trace-based compilation, in which the unit of compilation is a loop, potentially spanning multiple methods and even library code, and generates code that is competitive with traditional dynamic compilers, but that uses only a fraction of the compile time and memory footprint.
RPython: a step towards reconciling dynamically and statically typed OO languages
TLDR
An overview of RPython, including its design and its translation to both CLI and JVM bytecode, and how the bootstrapping phase can be used to implement advanced features, like extensible classes and generative programming.
...
...