ABSTRACT
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.
- JavaScript. http://www.ecma.ch/ecma1/STAND/ECMA-262.HTM.Google Scholar
- CPython. http://www.python.org/.Google Scholar
- Google V8 JavaScript engine. URL http://code.google.com/p/v8/.Google Scholar
- HipHop project. https://github.com/facebook/hiphop-php/wiki/.Google Scholar
- IronPython. http://ironpython.codeplex.com/.Google Scholar
- JRuby. http://jruby.org/.Google Scholar
- Jython. http://www.jython.org/.Google Scholar
- Python language. http://www.python.org.Google Scholar
- Rhino. http://www.mozilla.org/rhino/.Google Scholar
- Rubinius. http://rubini.us/.Google Scholar
- Shootout: the computer language benchmarks. http://shootout.alioth.debian.org/.Google Scholar
- SquirrelFish extreme JavaScript engine, 2008. http://webkit.org/blog/189/announcing-squirrelfish/.Google Scholar
- Unladen-Swallow project, . http://code.google.com/p/unladen-swallow/wiki/.Google Scholar
- Unladen-Swallow benchmarks, . http://code.google.com/p/unladen-swallow/wiki/Benchmarks.Google Scholar
- M. Bebenita, F. Brandner, M. Fahndrich, F. Logozzo, W. Schulte, N. Tillmann, and H. Venter. SPUR: a trace-based JIT compiler for CIL. In Proceedings of ACM conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 708--725, 2010. Google ScholarDigital Library
- S. Behnel, R. Bradshaw, and D. S. Seljebotn. Cython. http://cython.org/.Google Scholar
- C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the meta-level: PyPy's tracing JIT compiler. In Proceedings of the 4th workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems (ICOOOLPS), pages 18--25, 2009. Google ScholarDigital Library
- C. F. Bolz, A. Cuni, M. Fijalkowski, M. Leuschel, S. Pedroni, and A. Rigo. Allocation removal by partial evaluation in a tracing JIT. In Proceedings of the 20th ACM workshop on Partial Evaluation and Program Manipulation (PEPM), pages 43--52, 2011. Google ScholarDigital Library
- C. F. Bolz, A. Cuni, M. Fijalkowski, M. Leuschel, S. Pedroni, and A. Rigo. Runtime feedback in a meta-tracing JIT for efficient dynamic languages. In Proceedings of the 6th workshop on Implementation, Compilation, Optimization of Object-Oriented Languages, Programs and Systems (ICOOOLPS), 2011. Google ScholarDigital Library
- C. Chambers and D. Ungar. Making pure object-oriented languages practical. In Proceedings of ACM conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), volume 26, pages 1--15, 1991. Google ScholarDigital Library
- C. Chambers, D. Ungar, and E. Lee. An efficient implementation of self a dynamically-typed object-oriented language based on prototypes. In Proceedings of ACM conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 49--70, 1989. Google ScholarDigital 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 Proceedings of the 7th symposium on dynamic languages, pages 13--24, 2011. Google ScholarDigital Library
- J.-D. Choi, D. Grove, M. Hind, and V. Sarkar. Efficient and precise modeling of exceptions for the analysis of Java programs. In Proceedings of ACM workshop on program analysis for software tools and engineering, pages 21--31, 1999. Google ScholarDigital 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 Proceedings of ACM conference on Programming Language Design and Implementation (PLDI), pages 465--478, 2009. Google ScholarDigital Library
- C. Haubl and H. Mossenbock. Trace-based compilation for the Java HotSpot virtual machine. In Proceedings of ACM conference on the Principles and Practice of Programming in Java (PPPJ), pages 129--138, 2011. Google ScholarDigital Library
- A. Holkner and J. Harland. Evaluating the dynamic behaviour of Python applications. In Proceedings of the 33rd Australasian conference on computer science, pages 19--28, 2009. Google ScholarDigital Library
- U. Holzle and D. Ungar. A third generation Self implementation: Reconciling responsiveness with performance. In Proceedings of ACM conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), Oct. 1994. Google ScholarDigital Library
- U. Holzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Proceedings of ACM conference on Programming Language Design and Implementation (PLDI), June 1992. Google ScholarDigital Library
- K. Ishizaki, T. Ogasawara, J. Castanos, P. Nagpurkar, D. Edel-sohn, and T. Nakatani. Adding dynamically-typed language support to a statically-typed language compiler: performance evaluation, analysis, and tradeoffs. In Proceedings of conference on Virtual Execution Environments (VEE), pages 169--180, 2012. Google ScholarDigital Library
- P. G. Joisha. A principled approach to nondeferred reference-counting garbage collection. In Proceedings of conference on Virtual Execution Environments (VEE), pages 131--140, 2008. Google ScholarDigital Library
- C. Lattner and V. Adve. LLVM: A compilation frame-work for lifelong program analysis & transformation. In Proceedings of international symposium on Code Generation and Pptimization (CGO), Mar 2004. Google ScholarDigital Library
- N. Mostafa, C. Krintz, C. Cascaval, D. Edelsohn, P. Nag-purkar, and P. Wu. Understanding the potential of interpreter-based optimizations for Python. Technical Report 2010-14, UCSB, Jan 2010.Google Scholar
- M. Pall. LuaJIT. http://luajit.org/.Google Scholar
- J. Siek, S. Bharadwaj, and J. Baker. JVM summit: invokedynamic and Jython, 2011. http://wiki.jvmlangsummit.com/images/8/8d/Indy_and_Jython-Shashank_Bharadwaj.pdf.Google Scholar
- V. Sundaresan, D. Maier, P. Ramarao, and M. Stoodley. Experiences with multi-threading and dynamic class loading in a Java Just-In-Time compiler. In Proceedings of international symposium on Code Generation and Pptimization (CGO), pages 87--97, 2006. Google ScholarDigital Library
- M. Tatsubori, A. Tozawa, T. Suzumura, S. Trent, and T. Onodera. Evaluation of a Just-In-Time compiler retrofitted for PHP. In Proceedings of conference on Virtual Execution Environments (VEE), pages 121--132, 2010. Google ScholarDigital Library
- P. Wu, S. Midkiff, J. Moreira, and M. Gupta. Efficient support for complex numbers in Java. In Proceedings of the ACM conference on Java grande, pages 109--118, 1999. Google ScholarDigital Library
- P. Wu, H. Hayashizaki, H. Inoue, and T. Nakatani. Reducing trace selection footprint for large-scale java applications without performance loss. In Proceedings of ACM conference on Object-Oriented Programming, Systems, Languages, and Applications (OOPSLA), pages 789--804, 2011. Google ScholarDigital Library
- H. Zhao. HipHop compiler for PHP: Transforming PHP into C++. http://www.stanford.edu/class/ee380/Abstracts/100505.html.Google Scholar
Index Terms
- On the benefits and pitfalls of extending a statically typed language JIT compiler for dynamic scripting languages
Recommendations
On the benefits and pitfalls of extending a statically typed language JIT compiler for dynamic scripting languages
OOPSLA '12Whenever 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), ...
Adding dynamically-typed language support to a statically-typed language compiler: performance evaluation, analysis, and tradeoffs
VEE '12Applications written in dynamically typed scripting languages are increasingly popular for Web software development. Even on the server side, programmers are using dynamically typed scripting languages such as Ruby and Python to build complex ...
Automated scientific software scripting with SWIG
AbstractScripting languages such as Python and Tcl are a powerful tool for the construction of flexible scientific software because they provide scientists with an interpreted problem solving environment and they provide a modular framework ...
Comments