skip to main content
research-article
Open Access

HHVM JIT: a profile-guided, region-based compiler for PHP and Hack

Published:11 June 2018Publication History
Skip Abstract Section

Abstract

Dynamic 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, improving the performance of these languages has become more important. Efficiently compiling programs in these languages is challenging, and many popular dynamic languages still lack efficient production-quality implementations. This paper describes the design of the second generation of the HHVM JIT and how it addresses the challenges to efficiently execute PHP and Hack programs. This new design uses profiling to build an aggressive region-based JIT compiler. We discuss the benefits of this approach compared to the more popular method-based and trace-based approaches to compile dynamic languages. Our evaluation running a very large PHP-based code base, the Facebook website, demonstrates the effectiveness of the new JIT design.

Skip Supplemental Material Section

Supplemental Material

p151-ottoni.webm

References

  1. Keith Adams, Jason Evans, Bertrand Maher, Guilherme Ottoni, Andrew Paroski, Brett Simmers, Edwin Smith, and Owen Yamauchi. 2014. The Hiphop Virtual Machine. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications. 777–790. Google ScholarGoogle ScholarDigital LibraryDigital Library
  2. Alexa. 2017. The top 500 sites on the web. Web site: http://www.alexa.com/topsites.Google ScholarGoogle Scholar
  3. Eytan Bakshy and Eitan Frachtenberg. 2015. Design and Analysis of Benchmarking Experiments for Distributed Internet Services. In Proceedings of the International World Wide Web Conference. 108–118. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. Vasanth Bala, Evelyn Duesterwald, and Sanjeev Banerjia. 2000. Dynamo: A Transparent Dynamic Optimization System. In Proceedings of the ACM Conference on Programming Language Design and Implementation. 1–12. Google ScholarGoogle ScholarDigital LibraryDigital Library
  5. James R. Bell. 1973. Threaded Code. Commun. ACM 16, 6 (June 1973), 370–372. Google ScholarGoogle ScholarDigital LibraryDigital Library
  6. Fabrice Bellard. 2005. QEMU, a fast and portable dynamic translator. In Proceedings of the USENIX Annual Technical Conference. Google ScholarGoogle ScholarDigital LibraryDigital Library
  7. Brad Calder and Dirk Grunwald. 1994. Reducing Indirect Function Call Overhead in C++ Programs. In Proceedings of the ACM Symposium on Principles of Programming Languages. 397–408. Google ScholarGoogle ScholarDigital LibraryDigital Library
  8. C. Chambers and D. Ungar. 1989. Customization: Optimizing Compiler Technology for SELF, a Dynamically-typed Object-oriented Programming Language. In Proceedings of the ACM Conference on Programming Language Design and Implementation. 146–160. Google ScholarGoogle ScholarDigital LibraryDigital Library
  9. Craig Chambers and David Ungar. 1991. Making Pure Object-oriented Languages Practical. In Conference Proceedings on Object-oriented Programming Systems, Languages, and Applications. 1–15. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. George E. Collins. 1960. A Method for Overlapping and Erasure of Lists. Commun. ACM 3, 12 (December 1960). Google ScholarGoogle ScholarDigital LibraryDigital Library
  11. Emscripten Contributors. 2015. Emscripten: Optimizing Code – Very Large Codebases – Outlining. Web site: https://kripken.github.io/ emscripten-site/docs/optimizing/Optimizing-Code.html.Google ScholarGoogle Scholar
  12. Martyn Corden. 2014. Diagnostic 25464: Some optimizations were skipped to constrain compile time. Web site: https://software.intel.com/en-us/articles/fdiag25464.Google ScholarGoogle Scholar
  13. Ron Cytron, Jeanne Ferrante, Barry K. Rosen, Mark N. Wegman, and F. Kenneth Zadeck. 1991. Efficiently computing static single assignment form and the control dependence graph. ACM Transactions on Programming Languages and Systems 13, 4 (October 1991), 451–490. Google ScholarGoogle ScholarDigital LibraryDigital Library
  14. R. J. Dakin and P. C. Poole. 1973. A mixed code approach. Comput. J. 16, 3 (1973), 219–222.Google ScholarGoogle ScholarCross RefCross Ref
  15. J. L. Dawson. 1973. Combining interpretive code with machine code. Comput. J. 16, 3 (1973), 216–219.Google ScholarGoogle ScholarCross RefCross Ref
  16. James C. Dehnert, Brian K. Grant, John P. Banning, Richard Johnson, Thomas Kistler, Alexander Klaiber, and Jim Mattson. 2003. The Transmeta Code Morphing Software: Using Speculation, Recovery, and Adaptive Retranslation to Address Real-life Challenges. In Proceedings of the International Symposium on Code Generation and Optimization. 15–24. Google ScholarGoogle ScholarDigital LibraryDigital Library
  17. L. Peter Deutsch and Allan M. Schiffman. 1984. Efficient Implementation of the Smalltalk-80 System. In Proceedings of the ACM Symposium on Principles of Programming Languages. 297–302. Google ScholarGoogle ScholarDigital LibraryDigital Library
  18. Andreas Gal, Brendan Eich, Mike Shaver, David Anderson, David Mandelin, Mohammad R. Haghighat, Blake Kaplan, Graydon Hoare, Boris Zbarsky, Jason Orendorff, Jesse Ruderman, Edwin Smith, Rick Reitmaier, Michael Bebenita, Mason Chang, and Michael Franz. 2009. Trace-based just-in-time type specialization for dynamic languages. In Proceedings of the ACM Conference on Programming Language Design and Implementation. 465–478. Google ScholarGoogle ScholarDigital LibraryDigital Library
  19. GCC Team. 2017. GNU Compiler Collection. Web site: http://gcc.gnu.org.Google ScholarGoogle Scholar
  20. Jean Goubault. 1994. Generalized boxings, congruences and partial inlining. In Proceedings of the International Static Analysis Symposium. 147–161.Google ScholarGoogle ScholarCross RefCross Ref
  21. Hack. 2017. Web site: http://hacklang.org.Google ScholarGoogle Scholar
  22. Richard E Hank, Wen-Mei W Hwu, and B Ramakrishna Rau. 1995. Region-based compilation: An introduction and motivation. In Proceedings of the International Symposium on Microarchitecture. 158–168. Google ScholarGoogle ScholarDigital LibraryDigital Library
  23. HHVM Team. 2018. HHVM: The HipHop Virtual Machine. Web site: http://hhvm.com.Google ScholarGoogle Scholar
  24. Urs Hölzle, Craig Chambers, and David Ungar. 1992. Debugging Optimized Code with Dynamic Deoptimization. In Proceedings of the ACM Conference on Programming Language Design and Implementation. 32–43. Google ScholarGoogle ScholarDigital LibraryDigital Library
  25. Urs Hölzle and David Ungar. 1994. Optimizing Dynamically-dispatched Calls with Run-time Type Feedback. In Proceedings of the ACM Conference on Programming Language Design and Implementation. 326–336. Google ScholarGoogle ScholarDigital LibraryDigital Library
  26. Urs Hölzle and David Ungar. 1994. A Third-generation SELF Implementation: Reconciling Responsiveness with Performance. In Proceedings of the ACM Conference on Object-oriented Programming Systems, Language, and Applications. 229–243. Google ScholarGoogle ScholarDigital LibraryDigital Library
  27. Intel Corporation. 2011. Intel ® 64 and IA-32 Architectures Software Developer’s Manual. Number 325384-039US.Google ScholarGoogle Scholar
  28. Jens Knoop, Oliver Rüthing, and Bernhard Steffen. 1994. Partial Dead Code Elimination. In Proceedings of the ACM Conference on Programming Language Design and Implementation. 147–158. Google ScholarGoogle ScholarDigital LibraryDigital Library
  29. Benjamin Letham, Brian Karrer, Guilherme Ottoni, and Eytan Bakshy. 2017. Constrained Bayesian Optimization with Noisy Experiments. CoRR abs/1706.07094v1 (2017). http://arxiv.org/abs/1706.07094v1Google ScholarGoogle Scholar
  30. James G. Mitchell. 1970. The design and construction of flexible and efficient interactive programming systems. Ph.D. Dissertation. CarnegieMellon University. Google ScholarGoogle ScholarDigital LibraryDigital Library
  31. Guilherme Ottoni, Thomas Hartin, Christopher Weaver, Jason Brandt, Belliappa Kuttanna, and Hong Wang. 2011. Harmonia: a Transparent, Efficient, and Harmonious Dynamic Binary Translator Targeting x86. In Proceedings of the ACM International Conference on Computing Frontiers. 26:1–26:10. Google ScholarGoogle ScholarDigital LibraryDigital Library
  32. Guilherme Ottoni and Bertrand Maher. 2017. Optimizing Function Placement for Large-scale Data-center Applications. In Proceedings of the IEEE/ACM International Symposium on Code Generation and Optimization. 233–244. Google ScholarGoogle ScholarCross RefCross Ref
  33. Michael Paleczny, Christopher Vick, and Cliff Click. 2001. The Java™ HotSpot Server Compiler. In Proceedings of the Symposium on Java Virtual Machine Research and Technology Symposium. Google ScholarGoogle ScholarDigital LibraryDigital Library
  34. Karl Pettis and Robert C. Hansen. 1990. Profile Guided Code Positioning. In Proceedings of the ACM Conference on Programming Language Design and Implementation. 16–27. Google ScholarGoogle ScholarDigital LibraryDigital Library
  35. PHP. 2017. Web site: http://php.net.Google ScholarGoogle Scholar
  36. Armin Rigo and Samuele Pedroni. 2006. PyPy’s approach to virtual machine construction. In Proceedings of the ACM Symposium on Objectoriented Programming Systems, Languages, and Applications. 944–953. Google ScholarGoogle ScholarDigital LibraryDigital Library
  37. Toshio Suganuma, Toshiaki Yasue, and Toshio Nakatani. 2006. A region-based compilation technique for dynamic compilers. ACM Transactions on Programming Languages and Systems (TOPLAS) 28, 1 (2006), 134–174. Google ScholarGoogle ScholarDigital LibraryDigital Library
  38. HHVM Team. 2017. HHVM Users. Web site: https://github.com/facebook/hhvm/wiki/users.Google ScholarGoogle Scholar
  39. Spyridon Triantafyllis, Matthew J. Bridges, Easwaran Raman, Guilherme Ottoni, and David I. August. 2006. A Framework for Unrestricted Whole-program Optimization. In Proceedings of the ACM Conference on Programming Language Design and Implementation. 61–71. Google ScholarGoogle ScholarDigital LibraryDigital Library
  40. Christian Wimmer and Michael Franz. 2010. Linear Scan Register Allocation on SSA Form. In Proceedings of the IEEE/ACM International Symposium on Code Generation and Optimization. 170–179. Google ScholarGoogle ScholarDigital LibraryDigital Library
  41. Owen Yamauchi. 2012. On Garbage Collection. http://hhvm.com/blog/431/on-garbage-collection.Google ScholarGoogle Scholar
  42. Haiping Zhao, Iain Proctor, Minghui Yang, Xin Qi, Mark Williams, Qi Gao, Guilherme Ottoni, Andrew Paroski, Scott MacVicar, Jason Evans, and Stephen Tu. 2012. The HipHop Compiler for PHP. In Proceedings of the ACM International Conference on Object Oriented Programming Systems Languages and Applications. 575–586. Google ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. HHVM JIT: a profile-guided, region-based compiler for PHP and Hack

      Recommendations

      Comments

      Login options

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

      Sign in

      Full Access

      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!