skip to main content
research-article

Deoptimization for dynamic language JITs on typed, stack-based virtual machines

Authors Info & Claims
Published:01 March 2014Publication History
Skip Abstract Section

Abstract

We are interested in implementing dynamic language runtimes on top of language-level virtual machines. Type specialization is a critical optimization for dynamic language runtimes: generic code that handles any type of data is replaced with specialized code for particular types observed during execution. However, types can change, and the runtime must recover whenever unexpected types are encountered. The state-of-the-art recovery mechanism is called deoptimization. Deoptimization is a well-known technique for dynamic language runtimes implemented in low-level languages like C. However, no dynamic language runtime implemented on top of a virtual machine such as the Common Language Runtime (CLR) or the Java Virtual Machine (JVM) uses deoptimization, because the implementation thereof used in low-level languages is not possible.

In this paper we propose a novel technique that enables deoptimization for dynamic language runtimes implemented on top of typed, stack-based virtual machines. Our technique does not require any changes to the underlying virtual machine. We implement our proposed technique in a JavaScript language implementation, MCJS, running on top of the Mono runtime (CLR). We evaluate our implementation against the current state-of-the-art recovery mechanism for virtual machine-based runtimes, as implemented both in MCJS and in IronJS. We show that deoptimization provides significant performance benefits, even for runtimes running on top of a virtual machine.

References

  1. Sunspider benchmark suite. http://www.webkit.org/perf/sunspider/sunspider.htmlGoogle ScholarGoogle Scholar
  2. V8 benchmark suite. http://v8.googlecode.com/svn/data/benchmarks/v7/README.txtGoogle ScholarGoogle Scholar
  3. Ironjs javascript engine. https://github.com/fholm/IronJS, 2013.Google ScholarGoogle Scholar
  4. Js1k. http://js1k.com, 2013.Google ScholarGoogle Scholar
  5. M. Berndl, B. Vitale, M. Zaleski, and A. D. Brown. Context threading: A flexible and efficient dispatch technique for virtual machine interpreters. In Proceedings of the international symposium on Code generation and optimization, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. S. Brunthaler. Efficient interpretation using quickening. In Proceedings of the 6th Symposium on Dynamic Languages, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. S. Brunthaler. Inline caching meets quickening. In Proceedings of the 24th European Conference on Object-oriented Programming, 2010. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Crankshaft compiler. V8 engine. http://www.jayconrod.com/posts/54/a-tour-of-v8-crankshaft-the-optimizing-compiler, 2013.Google ScholarGoogle Scholar
  10. DLR. Microsoft Dynamic Language Runtime. http://dlr.codeplex.com/, 2013.Google ScholarGoogle Scholar
  11. G. Duboscq, T. Würthinger, L. Stadler, C. Wimmer, D. Simon, and H. Mössenböck. An intermediate representation for speculative optimizations in a dynamic compiler. In Proceedings of the sixth ACM workshop on Virtual machines and intermediate languages, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  12. S. J. Fink and F. Qian. Design, implementation and evaluation of adaptive recompilation with on-stack replacement. In Proceedings of the international symposium on Code generation and optimization: feedback-directed and runtime optimization, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  13. 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 the 2009 ACM SIGPLAN conference on Programming language design and implementation, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. B. Hackett and S.-y. Guo. Fast and precise hybrid type inference for javascript. In Proceedings of the 33rd ACM SIGPLAN conference on Programming Language Design and Implementation, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. U. Hölzle and D. Ungar. A third-generation self implementation: reconciling responsiveness with performance. In Proceedings of the ninth annual conference on Object-oriented programming systems, language, and applications, 1994. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. U. Hölzle, C. Chambers, and D. Ungar. Debugging optimized code with dynamic deoptimization. In Proceedings of the ACM SIGPLAN 1992 conference on Programming language design and implementation, 1992. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. K. Ishizaki, T. Ogasawara, J. Castanos, P. Nagpurkar, D. Edelsohn, and T. Nakatani. Adding dynamically-typed language support to a statically-typed language compiler: performance evaluation, analysis, and tradeoffs. In Proceedings of the 8th ACM SIGPLAN/SIGOPS conference on Virtual Execution Environments, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. M. N. Kedlaya, J. Roesch, B. Robatmili, M. Reshadi, and B. Hardekopf. Improved type specialization for dynamic scripting languages. In Proceedings of the 9th Symposium on Dynamic Languages, 2013. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. LuaJIT. Lua Just-In-Time compiler. http://luajit.org/, 2013.Google ScholarGoogle Scholar
  20. M. Paleczny, C. Vick, and C. Click. The java hotspot server compiler. In Proceedings of the 2001 Symposium on JavaTM Virtual Machine Research and Technology Symposium - Volume 1, 2001. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. B. Robatmili, C. Cascaval, M. Reshadi, M. N. Kedlaya, S. Fowler, M. Weber, and B. Hardekopf. Muscalietjs: Rethinking layered dynamic web runtimes. In Proceedings of the 10th ACM SIGPLAN/SIGOPS conference on Virtual Execution Environments, 2014. Google ScholarGoogle ScholarDigital LibraryDigital Library
  22. S. Soman and C. Krintz. Efficient and general on-stack replacement for aggressive program specialization. In Proceedings of the 2006 International Conference on Programming Languages and Compilers, 2006.Google ScholarGoogle Scholar
  23. SpiderMonkey. SpiderMonkey JavaScript Engine. http://www.mozilla.org/js/spidermonkey/, 2013.Google ScholarGoogle Scholar
  24. V8. Google Inc. V8 JavaScript virtual machine. https://code.google.com/ p/v8 2013.Google ScholarGoogle Scholar

Index Terms

  1. Deoptimization for dynamic language JITs on typed, stack-based virtual machines

    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

    Full Access

    PDF Format

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader
    About Cookies On This Site

    We use cookies to ensure that we give you the best experience on our website.

    Learn more

    Got it!