Abstract
The HipHop Virtual Machine (HHVM) is a JIT compiler and runtime for PHP. While PHP values are dynamically typed, real programs often have latent types that are useful for optimization once discovered. Some types can be proven through static analysis, but limitations in the ahead-of-time approach leave some types to be discovered at run time. And even though many values have latent types, PHP programs can also contain polymorphic variables and expressions, which must be handled without catastrophic slowdown.
HHVM discovers latent types by structuring its JIT around the concept of a tracelet. A tracelet is approximately a basic block specialized for a particular set of run-time types for its input values. Tracelets allow HHVM to exactly and efficiently learn the types observed by the program, while using a simple compiler. This paper shows that this approach enables HHVM to achieve high levels of performance, without sacrificing compatibility or interactivity.
- K. Adams and O. Agesen. A comparison of software and hardware techniques for x86 virtualization. In Proceedings of the International Conference on Architectural Support for Programming Languages and Operating Systems (ASPLOS), pages 2--13, October 2006. Google Scholar
Digital Library
- Apple. JavaScriptCore. Web site: http://trac.webkit.org/wiki/JavaScriptCore.Google Scholar
- M. Bebenita. Trace-Based Compilation and Optimization in Meta-Circular Virtual Execution Environments. PhD thesis, UC Irvine, 2012. Google Scholar
Digital Library
- J. Benda, T. Matousek, and L. Prosek. Phalanger: Compiling and running PHP applications on the Microsoft .NET platform. In Proceedings on the 4th International Conference on .NET Technologies, pages 11--20, 2006.Google Scholar
- P. Biggar, E. de Vries, and D. Gregg. A practical solution for scripting language compilers. In Proceedings of the ACM Symposium on Applied Computing, pages 1916--1923, 2009. Google Scholar
Digital Library
- B. Calder, P. Feller, and A. Eustace. Value profiling. In Proceedings of the IEEE/ACM International Symposium on Microarchitecture, pages 259--269, December 1997. Google Scholar
Digital Library
- J. Castanos, D. Edelsohn, K. Ishizaki, P. Nagpurkar, T. Nakatani, T. Ogasawara, and P. Wu. On the benefits and pitfalls of extending a statically typed language jit compiler for dynamic scripting languages. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications (OOPSLA), October 2012. Google Scholar
Digital Library
- B. Cmelik and D. Keppel. Shade: A fast instruction-set simulator for execution profiling. In T. Conte and C. Gimarc, editors, Fast Simulation of Computer Architectures, pages 5--46. Springer US, 1995.Google Scholar
Cross Ref
- G. E. Collins. A method for overlapping and erasure of lists. Communications of the ACM, 3(12), December 1960. Google Scholar
Digital Library
- R. Cytron, J. Ferrante, B. K. Rosen, M. N. Wegman, and F. K. Zadeck. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems, 13(4):451--490, October 1991. Google Scholar
Digital Library
- Facebook, Inc. The HipHop Virtual Machine. Web site: http://hhvm.com.Google Scholar
- M. Fijalkowski. HippyVM. Web site: http://hippyvm.com.Google Scholar
- 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, 2009. Google Scholar
Digital Library
- T. Garnett. Dynamic optimization of ia-32 applications under dynamorio. Master's thesis, 2003.Google Scholar
- A. Goldberg and D. Robson. Smalltalk-80: The Language and its Implementation. Addison-Wesley Longman Publishing Co. Inc., Boston, MA, 1983. Google Scholar
Digital Library
- Google. The V8 JavaScript engine. Web site: http://code.google.com/p/v8.Google Scholar
- U. Hölzle, C. Chambers, and D. Ungar. Optimizing dynamically-typed object-oriented languages with polymorphic inline caches. In Proceedings of the European Conference on Object-Oriented Programming, 1991. Google Scholar
Digital Library
- A. Homescu and A. Şuhan. HappyJIT: a tracing JIT compiler for PHP. In Proceedings of the 7th Symposium on Dynamic Languages, pages 25--36, 2011. Google Scholar
Digital Library
- C. Lattner and V. Adve. LLVM: A compilation framework for lifelong program analysis & transformation. In Proceedings of the International Symposium on Code Generation and Optimization, 2004. Google Scholar
Digital Library
- T. Lindholm and F. Yellin. Java Virtual Machine Specification. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 2nd edition, 1999. Google Scholar
Digital Library
- E. Meijer, R. Wa, and J. Gough. Technical overview of the common language runtime, 2000.Google Scholar
- Nginx. Nginx. Web site: http://wiki.nginx.org.Google Scholar
- G. Ottoni, T. Hartin, C. Weaver, J. Brandt, B. Kuttanna, and H. Wang. Harmonia: a transparent, efficient, and harmonious dynamic binary translator targeting x86. In Proc. of the 8th ACM International Conference on Computing Frontiers, pages 26:1--26:10, May 2011. Google Scholar
Digital Library
- M. Pall. The LuaJIT project. Web site: http://luajit.org.Google Scholar
- PHP5. Web site: http://php.net.Google Scholar
- F. Pizlo and G. Barraclough. Value profiling for code optimization, Feb. 13 2014. US Patent App. 13/593,404.Google Scholar
- Quercus: PHP in Java. Web site: http://www.caucho.com/resin-3.0/quercus/.Google Scholar
- A. Rigo and S. Pedroni. PyPy's approach to virtual machine construction. In Proceedings of the 21st ACM SIGPLAN Symposium on Object-oriented Programming Systems, Languages, and Applications, pages 944--953, 2006. Google Scholar
Digital Library
- Roadsend compiler. Web site: http://www.roadsend.com.Google Scholar
- M. Tatsubori, A. Tozawa, T. Suzumura, S. Trent, and T. Onodera. Evaluation of a just-in-time compiler retrofitted for PHP. In Proceedings of the ACM International Conference on Virtual Execution Environments, pages 121--132, 2010. Google Scholar
Digital Library
- The Apache Software Foundation. ab - Apache HTTP server benchmarking tool. Web site: http://httpd.apache.org/docs/2.2/programs/ab.html.Google Scholar
- The Computer Languages Benchmark Game. Web site: http://shootout.alioth.debian.org/.Google Scholar
- Tiobe. TIOBE programming community index. Web site: http://www.tiobe.com/tiobe_index/index.htm.Google Scholar
- A. Tozawa, M. Tatsubori, T. Onodera, and Y. Minamide. Copy-on-write in the PHP language. In Proceedings of the ACM Symposium on Principles of Programming Languages, pages 200--212, 2009. Google Scholar
Digital Library
- C. Wimmer and M. Franz. Linear scan register allocation on ssa form. In Proceedings of the IEEE/ACM International Symposium on Code Generation and Optimization, pages 170--179, 2010. Google Scholar
Digital Library
- C. Wimmer and T. Würthinger. Truffle: A self-optimizing runtime system. In Proceedings of the 3rd Annual Conference on Systems, Programming, and Applications: Software for Humanity, pages 13--14, 2012. Google Scholar
Digital Library
- E. Witchel and M. Rosenblum. Embra: Fast and flexible machine simulation. In Proceedings of the International Conference on Measurement and Modeling of Computer Systems, pages 68--79, 1996. Google Scholar
Digital Library
- H. Zhao, I. Proctor, M. Yang, X. Qi, M. Williams, Q. Gao, G. Ottoni, A. Paroski, S. MacVicar, J. Evans, and S. Tu. The HipHop compiler for PHP. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications, pages 575--586, October 2012. Google Scholar
Digital Library
Index Terms
The hiphop virtual machine
Recommendations
HHVM JIT: a profile-guided, region-based compiler for PHP and Hack
PLDI 2018: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and ImplementationDynamic languages such as PHP, JavaScript, Python, and Ruby have been gaining popularity over the last two decades. A very popular domain for these languages is web development, including server-side development of large-scale websites. As a result, ...
The hiphop virtual machine
OOPSLA '14: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & ApplicationsThe HipHop Virtual Machine (HHVM) is a JIT compiler and runtime for PHP. While PHP values are dynamically typed, real programs often have latent types that are useful for optimization once discovered. Some types can be proven through static analysis, ...
The HipHop compiler for PHP
OOPSLA '12Scripting languages are widely used to quickly accomplish a variety of tasks because of the high productivity they enable. Among other reasons, this increased productivity results from a combination of extensive libraries, fast development cycle, ...







Comments