skip to main content
10.1145/2384616.2384631acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

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

Authors Info & Claims
Published:19 October 2012Publication History

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.

References

  1. JavaScript. http://www.ecma.ch/ecma1/STAND/ECMA-262.HTM.Google ScholarGoogle Scholar
  2. CPython. http://www.python.org/.Google ScholarGoogle Scholar
  3. Google V8 JavaScript engine. URL http://code.google.com/p/v8/.Google ScholarGoogle Scholar
  4. HipHop project. https://github.com/facebook/hiphop-php/wiki/.Google ScholarGoogle Scholar
  5. IronPython. http://ironpython.codeplex.com/.Google ScholarGoogle Scholar
  6. JRuby. http://jruby.org/.Google ScholarGoogle Scholar
  7. Jython. http://www.jython.org/.Google ScholarGoogle Scholar
  8. Python language. http://www.python.org.Google ScholarGoogle Scholar
  9. Rhino. http://www.mozilla.org/rhino/.Google ScholarGoogle Scholar
  10. Rubinius. http://rubini.us/.Google ScholarGoogle Scholar
  11. Shootout: the computer language benchmarks. http://shootout.alioth.debian.org/.Google ScholarGoogle Scholar
  12. SquirrelFish extreme JavaScript engine, 2008. http://webkit.org/blog/189/announcing-squirrelfish/.Google ScholarGoogle Scholar
  13. Unladen-Swallow project, . http://code.google.com/p/unladen-swallow/wiki/.Google ScholarGoogle Scholar
  14. Unladen-Swallow benchmarks, . http://code.google.com/p/unladen-swallow/wiki/Benchmarks.Google ScholarGoogle Scholar
  15. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  16. S. Behnel, R. Bradshaw, and D. S. Seljebotn. Cython. http://cython.org/.Google ScholarGoogle Scholar
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  21. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  22. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  25. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  26. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  27. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  30. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  31. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  32. 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 ScholarGoogle Scholar
  33. M. Pall. LuaJIT. http://luajit.org/.Google ScholarGoogle Scholar
  34. 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 ScholarGoogle Scholar
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  39. H. Zhao. HipHop compiler for PHP: Transforming PHP into C++. http://www.stanford.edu/class/ee380/Abstracts/100505.html.Google ScholarGoogle Scholar

Index Terms

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

      Recommendations

      Comments

      Login options

      Check if you have access through your login credentials or your institution to get full access on this article.

      Sign in
      • Published in

        cover image ACM Conferences
        OOPSLA '12: Proceedings of the ACM international conference on Object oriented programming systems languages and applications
        October 2012
        1052 pages
        ISBN:9781450315616
        DOI:10.1145/2384616
        • cover image ACM SIGPLAN Notices
          ACM SIGPLAN Notices  Volume 47, Issue 10
          OOPSLA '12
          October 2012
          1011 pages
          ISSN:0362-1340
          EISSN:1558-1160
          DOI:10.1145/2398857
          Issue’s Table of Contents

        Copyright © 2012 ACM

        Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than ACM must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected]

        Publisher

        Association for Computing Machinery

        New York, NY, United States

        Publication History

        • Published: 19 October 2012

        Permissions

        Request permissions about this article.

        Request Permissions

        Check for updates

        Qualifiers

        • research-article

        Acceptance Rates

        Overall Acceptance Rate268of1,244submissions,22%

        Upcoming Conference

      PDF Format

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader