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.
- Sunspider benchmark suite. http://www.webkit.org/perf/sunspider/sunspider.htmlGoogle Scholar
- V8 benchmark suite. http://v8.googlecode.com/svn/data/benchmarks/v7/README.txtGoogle Scholar
- Ironjs javascript engine. https://github.com/fholm/IronJS, 2013.Google Scholar
- Js1k. http://js1k.com, 2013.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- S. Brunthaler. Efficient interpretation using quickening. In Proceedings of the 6th Symposium on Dynamic Languages, 2010. Google Scholar
Digital Library
- S. Brunthaler. Inline caching meets quickening. In Proceedings of the 24th European Conference on Object-oriented Programming, 2010. Google Scholar
Digital Library
- Crankshaft compiler. V8 engine. http://www.jayconrod.com/posts/54/a-tour-of-v8-crankshaft-the-optimizing-compiler, 2013.Google Scholar
- DLR. Microsoft Dynamic Language Runtime. http://dlr.codeplex.com/, 2013.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital 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 the 2009 ACM SIGPLAN conference on Programming language design and implementation, 2009. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- LuaJIT. Lua Just-In-Time compiler. http://luajit.org/, 2013.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
- SpiderMonkey. SpiderMonkey JavaScript Engine. http://www.mozilla.org/js/spidermonkey/, 2013.Google Scholar
- V8. Google Inc. V8 JavaScript virtual machine. https://code.google.com/ p/v8 2013.Google Scholar
Index Terms
Deoptimization for dynamic language JITs on typed, stack-based virtual machines
Recommendations
Deoptimization for dynamic language JITs on typed, stack-based virtual machines
VEE '14: Proceedings of the 10th ACM SIGPLAN/SIGOPS international conference on Virtual execution environmentsWe 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 ...
One compiler: deoptimization to optimized code
CC 2017: Proceedings of the 26th International Conference on Compiler ConstructionA multi-tier virtual machine (VM) deoptimizes and transfers last-tier execution to the first-tier execution when a speculative optimization is invalidated. The first-tier target of deoptimization is either an interpreter or code compiled by a baseline ...
An object storage model for the truffle language implementation framework
PPPJ '14: Proceedings of the 2014 International Conference on Principles and Practices of Programming on the Java platform: Virtual machines, Languages, and ToolsTruffle is a Java-based framework for developing high-performance language runtimes. Language implementers aiming at developing new runtimes have to design all the runtime mechanisms for managing dynamically typed objects from scratch. This not only ...







Comments