10.1145/1542476.1542528acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article

Trace-based just-in-time type specialization for dynamic languages

Authors Info & Claims
Published:15 June 2009Publication History

ABSTRACT

Dynamic languages such as JavaScript are more difficult to compile than statically typed ones. Since no concrete type information is available, traditional compilers need to emit generic code that can handle all possible type combinations at runtime. We present an alternative compilation technique for dynamically-typed languages that identifies frequently executed loop traces at run-time and then generates machine code on the fly that is specialized for the actual dynamic types occurring on each path through the loop. Our method provides cheap inter-procedural type specialization, and an elegant and efficient way of incrementally compiling lazily discovered alternative paths through nested loops. We have implemented a dynamic compiler for JavaScript based on our technique and we have measured speedups of 10x and more for certain benchmark programs.

References

  1. LuaJIT roadmap 2008 -- http://lua-users.org/lists/lua-l/2008-02/msg00051.html.Google ScholarGoogle Scholar
  2. Mozilla Firefox web browser and Thunderbird email client -- http://www.mozilla.com.Google ScholarGoogle Scholar
  3. SPECJVM98 -- http://www.spec.org/jvm98/.Google ScholarGoogle Scholar
  4. SpiderMonkey (JavaScript-C) Engine -- http://www.mozilla.org/js/spidermonkey/.Google ScholarGoogle Scholar
  5. Surfin' Safari -- Blog Archive -- Announcing SquirrelFish Extreme -- http://webkit.org/blog/214/introducing-squirrelfish-extreme/.Google ScholarGoogle Scholar
  6. A. Aho, R. Sethi, J. Ullman, and M. Lam. Compilers: Principles, techniques, and tools, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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
  8. M. Berndl, B. Vitale, M. Zaleski, and A. Brown. Context Threading: a Flexible and Efficient Dispatch Technique for Virtual Machine Interpreters. In Code Generation and Optimization, 2005. CGO 2005. International Symposium on, pages 15--26, 2005. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. C. Chambers and D. Ungar. Customization: Optimizing Compiler Technology for SELF, a Dynamically-Typed O bject-Oriented Programming Language. In Proceedings of the ACM SIGPLAN 1989 Conference on Programming Language Design and Implementation, pages 146--160. ACM New York, NY, USA, 1989. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. A. Gal. Efficient Bytecode Verification and Compilation in a Virtual Machine Dissertation. PhD thesis, University Of California, Irvine, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. 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
  12. C. Garrett, J. Dean, D. Grove, and C. Chambers. Measurement and Application of Dynamic Receiver Class Distributions. 1994.Google ScholarGoogle Scholar
  13. J. Ha, M. R. Haghighat, S. Cong, and K. S. McKinley. A concurrent trace-based just-in-time compiler for javascript. Dept.of Computer Sciences, The University of Texas at Austin, TR--09--06, 2009.Google ScholarGoogle Scholar
  14. B. McCloskey. Personal communication.Google ScholarGoogle Scholar
  15. I. Piumarta and F. Riccardi. Optimizing direct threaded code by selective inlining. In Proceedings of the ACM SIGPLAN 1998 conference on Programming language design and implementation, pages 291--300. ACM New York, NY, USA, 1998. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. A. Rigo. Representation-Based Just-In-time Specialization and the Psyco Prototype for Python. In PEPM, 2004. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. M. Salib. Starkiller: A Static Type Inferencer and Compiler for Python. Master's Thesis, 2004.Google ScholarGoogle Scholar
  18. T. Suganuma, T. Yasue, and T. Nakatani. A Region-Based Compilation Technique for Dynamic Compilers. ACM Transactions on Programming Languages and Systems (TOPLAS), 28(1):134--174, 2006. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. M. Zaleski, A. D. Brown, and K. Stoodley. YETI: A graduallY Extensible Trace Interpreter. In Proceedings of the International Conference on Virtual Execution Environments, pages 83--93. ACM Press, 2007. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. Trace-based just-in-time type specialization for dynamic languages

        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!