10.1145/1640134.1640147acmconferencesArticle/Chapter ViewAbstractPublication PagessplashConference Proceedingsconference-collections
research-article

Optimization of dynamic languages using hierarchical layering of virtual machines

Published:26 October 2009Publication History

ABSTRACT

Creating an interpreter is a simple and fast way to implement a dynamic programming language. With this ease also come major drawbacks. Interpreters are significantly slower than compiled machine code because they have a high dispatch overhead and cannot perform optimizations. To overcome these limitations, interpreters are commonly combined with just-in-time compilers to improve the overall performance. However, this means that a just-in-time compiler has to be implemented for each language.

We explore the approach of taking an interpreter of a dynamic language and running it on top of an optimizing trace-based virtual machine, i.e., we run a guest VM on top of a host VM. The host VM uses trace recording to observe the guest VM executing the application program. Each recorded trace represents a sequence of guest VM bytecodes corresponding to a given execution path through the application program. The host VM optimizes and compiles these traces to machine code, thus eliminating the need for a custom just-in-time compiler for the guest VM. The guest VM only needs to provide basic information about its interpreter loop to the host VM.

References

  1. Adobe Systems Inc. ActionScript 3 Language Specification, 2006. http://livedocs.adobe.com/specs/actionscript/3/wwhelp/wwhimpl/js/html/wwhelp.htm.Google ScholarGoogle Scholar
  2. Adobe Systems Inc. ActionScript Virtual Machine 2 Overview, 2007. http://www.adobe.com/devnet/actionscript/articles/avm2overview.pdf.Google ScholarGoogle Scholar
  3. Adobe Systems Inc. Adobe FlaCC, 2008. http://llvm.org/devmtg/2008-08/Petersen_FlashCCompiler.pdf.Google ScholarGoogle Scholar
  4. Adobe Systems Inc. Adobe Flex SDK, 2008. http://www.adobe.com/products/flex/flexdownloads/.Google ScholarGoogle Scholar
  5. Adobe Systems Inc. Adobe Alchemy, 2009. http://labs.adobe.com/technologies/alchemy/.Google ScholarGoogle Scholar
  6. V. Bala, E. Duesterwald, and S. Banerjia. Dynamo: A transparent dynamic optimization system. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 1--12. ACM Press, 2000. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. C. F. Bolz, A. Cuni, M. Fijalkowski, and A. Rigo. Tracing the meta-level: PyPy's tracing JIT compiler. In Proceedings of the Workshop on the Implementation, Compilation, Optimization of Object-Oriented Languages and Programming Systems, pages 18--25. ACM Press, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. M. Chang, E. Smith, R. Reitmaier, M. Bebenita, A. Gal, C. Wimmer, B. Eich, and M. Franz. Tracing for Web 3.0: Trace compilation for the next generation web applications. In Proceedings of the International Conference on Virtual Execution Environments, pages 71--80. ACM Press, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. B. Chiles. CLR inside out: IronPython and the dynamic language runtime. MSDN Magazine, October 2007.Google ScholarGoogle Scholar
  10. R. Cytron, J. Ferrante, B. Rosen, M. Wegman, and F. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, 1991. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. The Da Vinci Machine Project, 2008. http://openjdk.java.net/projects/mlvm/.Google ScholarGoogle Scholar
  12. Dynamic Language Runtime, 2008. http://www.codeplex.com/dlr/.Google ScholarGoogle Scholar
  13. ECMA. Standard ECMA-262: ECMAScript Language Specification, 3rd edition, 1999. http://www.ecma-international.org/publications/standards/Ecma-262.htm.Google ScholarGoogle Scholar
  14. A. Gal, B. Eich, M. Shaver, D. Anderson, D. Mandelin, M. R. Haghighat, B. Kaplan, G. Hoare, B. Zbarsky, J. Orendorff, J. Ruderman, E. Smith, R. Reitmaier, M. Bebenita, M. Chang, and M. Franz. Trace-based just-in-time type specialization for dynamic languages. In Proceedings of the ACM SIGPLAN Conference on Programming Language Design and Implementation, pages 465--478. ACM Press, 2009. Google ScholarGoogle ScholarDigital LibraryDigital Library
  15. A. Gal, C. W. Probst, and M. Franz. HotpathVM: An effective JIT compiler for resource-constrained devices. In Proceedings of the International Conference on Virtual Execution Environments, pages 144--153. ACM Press, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. J. Ha, M. R. Haghighat, S. Cong, and K. S. McKinley. A concurrent trace-based just-in-time compiler for JavaScript. Technical Report TR-09-06, University of Texas, Austin, 2009.Google ScholarGoogle Scholar
  17. R. Ierusalimschy, L. H. de Figueiredo, and W. C. Filho. Lua - an extensible extension language. Software: Practice and Experience, 26(6):635--652, 1996. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. IronPython, 2009. http://www.codeplex.com/Wiki/View.aspx?ProjectName=IronPython.Google ScholarGoogle Scholar
  19. Java Specification Request 223: Scripting for the Java™ Platform, 2006. http://www.jcp.org/en/jsr/detail?id=223.Google ScholarGoogle Scholar
  20. The Jython Project, 2009. http://www.jython.org/Project/.Google ScholarGoogle Scholar
  21. The LLVM Compiler Infrastructure, 2009. http://llvm.org/.Google ScholarGoogle Scholar
  22. Lua Benchmarks, 2009. http://shootout.alioth.debian.org/gp4/lua.php.Google ScholarGoogle Scholar
  23. Lua Programming Language, 2009. http://www.lua.org/. Google ScholarGoogle ScholarDigital LibraryDigital Library
  24. D. Mandelin. Tamarin Tracing Internals, Part I to V, 2008. http://blog.mozilla.com/dmandelin/2008/05/.Google ScholarGoogle Scholar
  25. PyPy, 2009. http://codespeak.net/pypy/.Google ScholarGoogle Scholar
  26. Scripting Engines for Java, 2008. https://scripting.dev.java.net/.Google ScholarGoogle Scholar
  27. G. T. Sullivan, D. L. Burening, I. Baron, T. Garnett, and S. Amarasinghe. Dynamic native optimization of interpreters. In Proceedings of the Workshop on Interpreters, Virtual Machines, and Emulators, pages 50--57. ACM Press, 2003. Google ScholarGoogle ScholarDigital LibraryDigital Library
  28. R. Uhlig, G. Neiger, D. Rodgers, A. L. Santoni, F. C. M. Martins, A. V. Anderson, S. M. Bennett, A. Kagi, F. H. Leung, and L. Smith. Intel virtualization technology. Computer, 38(5):48--56, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Optimization of dynamic languages using hierarchical layering of virtual machines

    Reviews

    R. Clayton

    What happens when a host virtual machine (VM) that uses trace-driven just-in-time (JIT) compilation executes another VM, the guest VM__?__ How much do the programs that execute on the guest VM benefit from the optimizations on the host VM__?__ How can the host-guest interactions be altered to provide greater benefits to guest-executed programs__?__ In this paper, the authors address these questions. Trace-driven optimization focuses on frequently executed program sections. VMs use trace-driven optimization to restrict JIT compilation to program sections that are most likely to benefit from the expensive, complex optimization. Host VM benefits are delivered to the guest programs through the guest VM. The host VM uses a combined guest program-VM program counter to clarify loops in the guest program, and relies on the guest VM to identify immutable code regions, in order to enable more rigorous host VM optimizations. The implementation is a bit jury-rigged. The host trace-driven JIT VM executes ActionScript 3 (AS3). Since the guest VM for the Lua dynamic programming language was written in C, it had to be translated to AS3. The results, however, are impressive: "This approach leads to a considerable speedup ... when a well-established interpreter-based dynamic language is executed on top of a VM that already uses a trace-based JIT compiler." The paper is well written. While it is not necessary for readers to be familiar with the languages discussed, they should have basic interpreter knowledge. Online Computing Reviews Service

    Access critical reviews of Computing literature here

    Become a reviewer for Computing Reviews.

    Comments

    Login options

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

    Sign in

    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!