Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
skip to main content
10.1145/3192366.3192374acmconferencesArticle/Chapter ViewAbstractPublication PagespldiConference Proceedingsconference-collections
research-article
Open access

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

Published: 11 June 2018 Publication History

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.

Supplementary Material

WEBM File (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.
[2]
Alexa. 2017. The top 500 sites on the web. Web site: http://www.alexa.com/topsites.
[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.
[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.
[5]
James R. Bell. 1973. Threaded Code. Commun. ACM 16, 6 (June 1973), 370–372.
[6]
Fabrice Bellard. 2005. QEMU, a fast and portable dynamic translator. In Proceedings of the USENIX Annual Technical Conference.
[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.
[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.
[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.
[10]
George E. Collins. 1960. A Method for Overlapping and Erasure of Lists. Commun. ACM 3, 12 (December 1960).
[11]
Emscripten Contributors. 2015. Emscripten: Optimizing Code – Very Large Codebases – Outlining. Web site: https://kripken.github.io/ emscripten-site/docs/optimizing/Optimizing-Code.html.
[12]
Martyn Corden. 2014. Diagnostic 25464: Some optimizations were skipped to constrain compile time. Web site: https://software.intel.com/en-us/articles/fdiag25464.
[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.
[14]
R. J. Dakin and P. C. Poole. 1973. A mixed code approach. Comput. J. 16, 3 (1973), 219–222.
[15]
J. L. Dawson. 1973. Combining interpretive code with machine code. Comput. J. 16, 3 (1973), 216–219.
[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.
[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.
[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.
[19]
GCC Team. 2017. GNU Compiler Collection. Web site: http://gcc.gnu.org.
[20]
Jean Goubault. 1994. Generalized boxings, congruences and partial inlining. In Proceedings of the International Static Analysis Symposium. 147–161.
[21]
Hack. 2017. Web site: http://hacklang.org.
[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.
[23]
HHVM Team. 2018. HHVM: The HipHop Virtual Machine. Web site: http://hhvm.com.
[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.
[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.
[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.
[27]
Intel Corporation. 2011. Intel ® 64 and IA-32 Architectures Software Developer’s Manual. Number 325384-039US.
[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.
[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.07094v1
[30]
James G. Mitchell. 1970. The design and construction of flexible and efficient interactive programming systems. Ph.D. Dissertation. CarnegieMellon University.
[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.
[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.
[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.
[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.
[35]
PHP. 2017. Web site: http://php.net.
[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.
[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.
[38]
HHVM Team. 2017. HHVM Users. Web site: https://github.com/facebook/hhvm/wiki/users.
[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.
[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.
[41]
Owen Yamauchi. 2012. On Garbage Collection. http://hhvm.com/blog/431/on-garbage-collection.
[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.

Cited By

View all
  • (2024)Stale Profile MatchingProceedings of the 33rd ACM SIGPLAN International Conference on Compiler Construction10.1145/3640537.3641573(162-173)Online publication date: 17-Feb-2024
  • (2023)Unleashing SmartNIC Packet Processing Performance in P4Proceedings of the ACM SIGCOMM 2023 Conference10.1145/3603269.3604882(1028-1042)Online publication date: 10-Sep-2023
  • (2023)HHVM Performance Optimization for Large Scale Web ServicesProceedings of the 2023 ACM/SPEC International Conference on Performance Engineering10.1145/3578244.3583720(137-148)Online publication date: 15-Apr-2023
  • Show More Cited By

Index Terms

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

      Recommendations

      Comments

      Information & Contributors

      Information

      Published In

      cover image ACM Conferences
      PLDI 2018: Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation
      June 2018
      825 pages
      ISBN:9781450356985
      DOI:10.1145/3192366
      Permission to make digital or hard copies of part or all of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for third-party components of this work must be honored. For all other uses, contact the Owner/Author.

      Sponsors

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      Published: 11 June 2018

      Check for updates

      Author Tags

      1. Hack
      2. PHP
      3. code optimizations
      4. dynamic languages
      5. profile-guided optimizations
      6. region-based compilation
      7. web server applications

      Qualifiers

      • Research-article

      Conference

      PLDI '18
      Sponsor:

      Acceptance Rates

      Overall Acceptance Rate 406 of 2,067 submissions, 20%

      Contributors

      Other Metrics

      Bibliometrics & Citations

      Bibliometrics

      Article Metrics

      • Downloads (Last 12 months)397
      • Downloads (Last 6 weeks)53
      Reflects downloads up to 13 Jan 2025

      Other Metrics

      Citations

      Cited By

      View all
      • (2024)Stale Profile MatchingProceedings of the 33rd ACM SIGPLAN International Conference on Compiler Construction10.1145/3640537.3641573(162-173)Online publication date: 17-Feb-2024
      • (2023)Unleashing SmartNIC Packet Processing Performance in P4Proceedings of the ACM SIGCOMM 2023 Conference10.1145/3603269.3604882(1028-1042)Online publication date: 10-Sep-2023
      • (2023)HHVM Performance Optimization for Large Scale Web ServicesProceedings of the 2023 ACM/SPEC International Conference on Performance Engineering10.1145/3578244.3583720(137-148)Online publication date: 15-Apr-2023
      • (2023)Optimizing the Order of Bytecode Handlers in Interpreters using a Genetic AlgorithmProceedings of the 38th ACM/SIGAPP Symposium on Applied Computing10.1145/3555776.3577712(1384-1393)Online publication date: 27-Mar-2023
      • (2023)JACO: JAva Code Layout Optimizer Enabling Continuous Optimization without Pausing Application Services2023 IEEE International Conference on Cluster Computing (CLUSTER)10.1109/CLUSTER52292.2023.00032(295-306)Online publication date: 31-Oct-2023
      • (2023)Enabling hyperscale web servicesBenchCouncil Transactions on Benchmarks, Standards and Evaluations10.1016/j.tbench.2023.1000923:1(100092)Online publication date: Feb-2023
      • (2022)One Profile Fits AllACM SIGOPS Operating Systems Review10.1145/3544497.354450256:1(26-33)Online publication date: 14-Jun-2022
      • (2022)Profile inference revisitedProceedings of the ACM on Programming Languages10.1145/34987146:POPL(1-24)Online publication date: 12-Jan-2022
      • (2022)Whisper: Profile-Guided Branch Misprediction Elimination for Data Center Applications2022 55th IEEE/ACM International Symposium on Microarchitecture (MICRO)10.1109/MICRO56248.2022.00017(19-34)Online publication date: Oct-2022
      • (2021)Type stability in Julia: avoiding performance pathologies in JIT compilationProceedings of the ACM on Programming Languages10.1145/34855275:OOPSLA(1-26)Online publication date: 15-Oct-2021
      • Show More Cited By

      View Options

      View options

      PDF

      View or Download as a PDF file.

      PDF

      eReader

      View online with eReader.

      eReader

      Login options

      Media

      Figures

      Other

      Tables

      Share

      Share

      Share this Publication link

      Share on social media