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
- LuaJIT roadmap 2008 -- http://lua-users.org/lists/lua-l/2008-02/msg00051.html.Google Scholar
- Mozilla Firefox web browser and Thunderbird email client -- http://www.mozilla.com.Google Scholar
- SPECJVM98 -- http://www.spec.org/jvm98/.Google Scholar
- SpiderMonkey (JavaScript-C) Engine -- http://www.mozilla.org/js/spidermonkey/.Google Scholar
- Surfin' Safari -- Blog Archive -- Announcing SquirrelFish Extreme -- http://webkit.org/blog/214/introducing-squirrelfish-extreme/.Google Scholar
- A. Aho, R. Sethi, J. Ullman, and M. Lam. Compilers: Principles, techniques, and tools, 2006. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
- A. Gal. Efficient Bytecode Verification and Compilation in a Virtual Machine Dissertation. PhD thesis, University Of California, Irvine, 2006. Google Scholar
Digital Library
- 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 Scholar
Digital Library
- C. Garrett, J. Dean, D. Grove, and C. Chambers. Measurement and Application of Dynamic Receiver Class Distributions. 1994.Google Scholar
- 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 Scholar
- B. McCloskey. Personal communication.Google Scholar
- 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 Scholar
Digital Library
- A. Rigo. Representation-Based Just-In-time Specialization and the Psyco Prototype for Python. In PEPM, 2004. Google Scholar
Digital Library
- M. Salib. Starkiller: A Static Type Inferencer and Compiler for Python. Master's Thesis, 2004.Google Scholar
- 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 Scholar
Digital Library
- 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 Scholar
Digital Library
Index Terms
Trace-based just-in-time type specialization for dynamic languages






Comments