HipHop Virtual Machine

From Wikipedia, the free encyclopedia
Jump to: navigation, search
HipHop Virtual Machine
HHVM - Logo.png
Developer(s) Facebook
Initial release December 9, 2011; 3 years ago (2011-12-09)[1]
Stable release 3.6.1[2] / March 24, 2015; 22 days ago (2015-03-24)
Development status Active
Written in C++, C
License PHP License and Zend License[3]

HipHop Virtual Machine (HHVM) is a process virtual machine based on just-in-time (JIT) compilation, serving as an execution engine for PHP and Hack programming languages. By using the principle of JIT compilation, executed PHP or Hack code is first transformed into intermediate HipHop bytecode (HHBC), which is then dynamically translated into the x86-64 machine code, optimized and natively executed.[1][4] This contrasts to the PHP's usual interpreted execution, in which the Zend Engine transforms the PHP source code into opcodes as a form of intermediate code, and executes the opcodes directly on the Zend Engine's virtual CPU.[5]

HHVM is developed by Facebook, with the project's source code hosted on GitHub and licensed under the terms of the PHP License and Zend License.[1][3]


HHVM is created as the successor of the HipHop for PHP (HPHPc) PHP execution engine, which is a PHP-to-C++ transpiler also created by Facebook.[6][7] Based on the gained experience and aiming to solve issues brought by HPHPc, in early 2010 Facebook decided to create a JIT-based PHP virtual machine.[8] Issues associated with HPHPc included its flattened curve for further performance improvements, lack of full support for the PHP language, and difficulties related to specific time- and resource-consuming development and deployment processes.[6] In Q1 2013, the production version of switched from using HPHPc to HHVM.

Following the JIT compilation principle, HHVM converts executed PHP or Hack code into HHBC as a high-level bytecode, which is also known as intermediate language. HHBC is a bytecode format created specifically for HHVM, in a form that is appropriate for consumption by interpreters and just-in-time compilers. HHBC is then dynamically ("just-in-time") translated into the x86-64 machine code and natively executed, with additional optimizations performed through dynamic analysis of the translated bytecode.[1][6][9] In these respects, HHVM has certain similarities to the virtual machines used by other programming languages, including the Common Language Runtime (CLR, for the C# language) and Java virtual machine (JVM, for the Java language).

HHVM brings many benefits over HPHPc; one of them is almost complete support for the entire PHP language as defined by its official 5.4 version, including the support for create_function() and eval() constructs.[10][11] Also, with HHVM there is only one execution engine for both production and development environments, meaning that maintaining HPHPi separately is no longer required, and there exists both production and development integration with HPHPd. At the same time, development and deployment processes are much simpler when compared to HPHPc, as the lengthy binary build time is no longer present.

Together with HHVM, Facebook also released Hack, a programming language specifically tailored for HHVM that can be seen as a new version of PHP.[12][13] Hack allows programmers to use both dynamic typing and static typing (a concept also known as gradual typing), and allows types to be specified for function arguments, function return values, and class properties; however, types of local variables cannot be specified. At the same time, Hack does not carry on some of the PHP features.[14][15][16][17]


Studies of end-user behavior conclude that lack of website speed and even small delays in web server response time, lower than half of a second, can have significant negative impacts on end-user experience and overall web site performance.[18] Some formerly popular websites, such as Friendster, have suffered due to prolonged speed issues.[19]

As a process virtual machine that provides the execution environment, HHVM has the ability to use live type information to produce more efficient native code, leading to higher web server throughput and lower latency. In Q4 2012, the performance of code running on HHVM achieved parity with HPHPc,[6] while in December 2013 it was even surpassed by around 15%.[20]

See also[edit]


  1. ^ a b c d Jason Evans (December 9, 2011). "The HipHop Virtual Machine". Facebook. Retrieved August 2, 2014. 
  2. ^ "facebook/hhvm: Release HHVM-3.6.1". Facebook. March 24, 2015. Retrieved March 27, 2015. 
  3. ^ a b "facebook/hhvm: License". Facebook. Retrieved August 2, 2014. 
  4. ^ "facebook/hhvm". Facebook. Retrieved August 2, 2014. 
  5. ^ Kaushik Pal (April 28, 2014). "PHP and Zend Engine Internals". Retrieved September 23, 2014. 
  6. ^ a b c d Drew Paroski (November 29, 2012). "Speeding up PHP-based development with HHVM". Facebook. Retrieved August 2, 2014. 
  7. ^ "Announcement on GitHub removing HPHPc support". Facebook. February 19, 2013. Retrieved May 24, 2013. 
  8. ^ Cade Metz (June 10, 2013). "How Three Guys Rebuilt the Foundation of Facebook". Wired. Retrieved September 28, 2014. 
  9. ^ "HipHop Bytecode v1 revision 18". Facebook. July 31, 2014. Retrieved May 24, 2013. 
  10. ^ "facebook/hhvm: About upgrade to PHP 5.4 engine". May 2013. Retrieved August 2, 2014. 
  11. ^ "facebook/hhvm: Home". Facebook. May 8, 2014. Retrieved August 2, 2014. 
  12. ^ Cade Metz (March 20, 2014). "Facebook Introduces 'Hack,' the Programming Language of the Future". Wired. Retrieved April 15, 2014. 
  13. ^ Julien Verlaguet; Alok Menghrajani (April 2014). "Hack: a new programming language for HHVM". Facebook. Retrieved March 23, 2014. 
  14. ^ Josh Lockhart (April 3, 2014). "Facebook’s Hack, HHVM, and the future of PHP". O'Reilly Media. Retrieved August 2, 2014. 
  15. ^ "Hack and HHVM: Type Annotations (Hack Manual)". Retrieved March 25, 2014. 
  16. ^ "Hack and HHVM: Type Inference (Hack Manual)". Retrieved March 25, 2014. 
  17. ^ "Hack and HHVM: Unsupported PHP Features in Hack (Hack Manual)". Retrieved April 2, 2014. 
  18. ^ Brady Forrest (June 23, 2009). "Bing and Google Agree: Slow Pages Lose Users". O'Reilly Media. Retrieved September 28, 2014. 
  19. ^ Gary Rivlin (October 5, 2006). "Wallflower at the Web Party". The New York Times. Retrieved September 28, 2014. 
  20. ^ "We are the 98.5% (and the 16%)". December 19, 2013. Retrieved August 2, 2014. 

External links[edit]