On the benefits and pitfalls of extending a statically typed language JIT compiler for dynamic scripting languages

Whenever the need to compile a new dynamically typed language arises, an appealing option is to repurpose an existing statically typed language Just-In-Time (JIT) compiler (repurposed JIT compiler). Existing repurposed JIT compilers (RJIT compilers), however, have not yet delivered the hoped-for performance boosts. The performance of JVM languages, for instance, often lags behind standard interpreter implementations. Even more customized solutions that extend the internals of a JIT compiler for the target language compete poorly with those designed specifically for dynamically typed languages. Our own Fiorano JIT compiler is an example of this problem. As a state-of-the-art, RJIT compiler for Python, the Fiorano JIT compiler outperforms two other RJIT compilers (Unladen Swallow and Jython), but still shows a noticeable performance gap compared to PyPy, today's best performing Python JIT compiler. In this paper, we discuss techniques that have proved effective in the Fiorano JIT compiler as well as limitations of our current implementation. More importantly, this work offers the first in-depth look at benefits and limitations of the repurposed JIT compiler approach. We believe the most common pitfall of existing RJIT compilers is not focusing sufficiently on specialization, an abundant optimization opportunity unique to dynamically typed languages. Unfortunately, the lack of specialization cannot be overcome by applying traditional optimizations.

[1]  Carl Friedrich Bolz,et al.  Tracing the meta-level: PyPy's tracing JIT compiler , 2009, ICOOOLPS@ECOOP.

[2]  Samuel P. Midkiff,et al.  Efficient support for complex numbers in Java , 1999, JAVA '99.

[3]  Toshio Nakatani,et al.  Adding dynamically-typed language support to a statically-typed language compiler: performance evaluation, analysis, and tradeoffs , 2012, VEE '12.

[4]  Mason Chang,et al.  Trace-based just-in-time type specialization for dynamic languages , 2009, PLDI '09.

[5]  Daryl Maier,et al.  Experiences with multi-threading and dynamic class loading in a Java just-in-time compiler , 2006, International Symposium on Code Generation and Optimization (CGO'06).

[6]  Jong-Deok Choi,et al.  Efficient and precise modeling of exceptions for the analysis of Java programs , 1999, PASTE '99.

[7]  Hanspeter Mössenböck,et al.  Trace-based compilation for the Java HotSpot virtual machine , 2011, PPPJ.

[8]  Michael Leuschel,et al.  Allocation removal by partial evaluation in a tracing JIT , 2011, PEPM '11.

[9]  Michael Leuschel,et al.  Runtime feedback in a meta-tracing JIT for efficient dynamic languages , 2011, ICOOOLPS@ECOOP.

[10]  Avik Chaudhuri,et al.  The impact of optional type information on jit compilation of dynamically typed languages , 2011, DLS '11.

[11]  Pramod G. Joisha,et al.  A principled approach to nondeferred reference-counting garbage collection , 2008, VEE '08.

[12]  Urs Hölzle,et al.  A third-generation SELF implementation: reconciling responsiveness with performance , 1994, OOPSLA '94.

[13]  Vikram S. Adve,et al.  LLVM: a compilation framework for lifelong program analysis & transformation , 2004, International Symposium on Code Generation and Optimization, 2004. CGO 2004..

[14]  Craig Chambers,et al.  Debugging optimized code with dynamic deoptimization , 1992, PLDI '92.

[15]  Craig Chambers,et al.  Making pure object-oriented languages practical , 1991, OOPSLA '91.

[16]  Michiaki Tatsubori,et al.  Evaluation of a just-in-time compiler retrofitted for PHP , 2010, VEE '10.

[17]  Toshio Nakatani,et al.  Reducing trace selection footprint for large-scale Java applications without performance loss , 2011, OOPSLA '11.

[18]  Craig Chambers,et al.  An efficient implementation of SELF, a dynamically-typed object-oriented language based on prototypes , 1989, OOPSLA '89.

[19]  Nikolai Tillmann,et al.  SPUR: a trace-based JIT compiler for CIL , 2010, OOPSLA.

[20]  James Harland,et al.  Evaluating the dynamic behaviour of Python applications , 2009, ACSC.