skip to main content
research-article
Open Access

The hiphop virtual machine

Published:15 October 2014Publication History
Skip Abstract Section

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.

References

  1. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  2. Apple. JavaScriptCore. Web site: http://trac.webkit.org/wiki/JavaScriptCore.Google ScholarGoogle Scholar
  3. M. Bebenita. Trace-Based Compilation and Optimization in Meta-Circular Virtual Execution Environments. PhD thesis, UC Irvine, 2012. Google ScholarGoogle ScholarDigital LibraryDigital Library
  4. 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 ScholarGoogle Scholar
  5. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  6. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  7. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  8. 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 ScholarGoogle ScholarCross RefCross Ref
  9. G. E. Collins. A method for overlapping and erasure of lists. Communications of the ACM, 3(12), December 1960. Google ScholarGoogle ScholarDigital LibraryDigital Library
  10. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  11. Facebook, Inc. The HipHop Virtual Machine. Web site: http://hhvm.com.Google ScholarGoogle Scholar
  12. M. Fijalkowski. HippyVM. Web site: http://hippyvm.com.Google ScholarGoogle Scholar
  13. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  14. T. Garnett. Dynamic optimization of ia-32 applications under dynamorio. Master's thesis, 2003.Google ScholarGoogle Scholar
  15. A. Goldberg and D. Robson. Smalltalk-80: The Language and its Implementation. Addison-Wesley Longman Publishing Co. Inc., Boston, MA, 1983. Google ScholarGoogle ScholarDigital LibraryDigital Library
  16. Google. The V8 JavaScript engine. Web site: http://code.google.com/p/v8.Google ScholarGoogle Scholar
  17. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  18. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  19. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  20. T. Lindholm and F. Yellin. Java Virtual Machine Specification. Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA, 2nd edition, 1999. Google ScholarGoogle ScholarDigital LibraryDigital Library
  21. E. Meijer, R. Wa, and J. Gough. Technical overview of the common language runtime, 2000.Google ScholarGoogle Scholar
  22. Nginx. Nginx. Web site: http://wiki.nginx.org.Google ScholarGoogle Scholar
  23. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  24. M. Pall. The LuaJIT project. Web site: http://luajit.org.Google ScholarGoogle Scholar
  25. PHP5. Web site: http://php.net.Google ScholarGoogle Scholar
  26. F. Pizlo and G. Barraclough. Value profiling for code optimization, Feb. 13 2014. US Patent App. 13/593,404.Google ScholarGoogle Scholar
  27. Quercus: PHP in Java. Web site: http://www.caucho.com/resin-3.0/quercus/.Google ScholarGoogle Scholar
  28. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  29. Roadsend compiler. Web site: http://www.roadsend.com.Google ScholarGoogle Scholar
  30. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  31. The Apache Software Foundation. ab - Apache HTTP server benchmarking tool. Web site: http://httpd.apache.org/docs/2.2/programs/ab.html.Google ScholarGoogle Scholar
  32. The Computer Languages Benchmark Game. Web site: http://shootout.alioth.debian.org/.Google ScholarGoogle Scholar
  33. Tiobe. TIOBE programming community index. Web site: http://www.tiobe.com/tiobe_index/index.htm.Google ScholarGoogle Scholar
  34. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  35. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  36. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  37. 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 ScholarGoogle ScholarDigital LibraryDigital Library
  38. 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 ScholarGoogle ScholarDigital LibraryDigital Library

Index Terms

  1. The hiphop virtual machine

    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

    • Published in

      cover image ACM SIGPLAN Notices
      ACM SIGPLAN Notices  Volume 49, Issue 10
      OOPSLA '14
      October 2014
      907 pages
      ISSN:0362-1340
      EISSN:1558-1160
      DOI:10.1145/2714064
      • Editor:
      • Andy Gill
      Issue’s Table of Contents
      • cover image ACM Conferences
        OOPSLA '14: Proceedings of the 2014 ACM International Conference on Object Oriented Programming Systems Languages & Applications
        October 2014
        946 pages
        ISBN:9781450325851
        DOI:10.1145/2660193

      Copyright © 2014 Owner/Author

      Publisher

      Association for Computing Machinery

      New York, NY, United States

      Publication History

      • Published: 15 October 2014

      Check for updates

      Qualifiers

      • research-article

    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!