|Initial release||December 9, 2011|
|Stable release||4.158.0 (20 April 2022)|
|Written in||PHP, C++, OCaml[lower-alpha 1] and Rust|
|License||PHP License and Zend License|
HipHop Virtual Machine (HHVM) is an open-source virtual machine based on just-in-time (JIT) compilation that serves as an execution engine for the Hack programming language. By using the principle of JIT compilation, Hack code is first transformed into intermediate HipHop bytecode (HHBC), which is then dynamically translated into x86-64 machine code, optimized, and natively executed. This contrasts with PHP's usual interpreted execution, in which the Zend Engine transforms PHP source code into opcodes that serve as a form of bytecode, and executes the opcodes directly on the Zend Engine's virtual CPU.
HHVM was created as the successor to the HipHop for PHP (HPHPc) PHP execution engine, which is a PHP-to-C++ transpiler also created by Facebook. Based on the gained experience and aiming to solve issues introduced by HPHPc, Meta decided in early 2010 to create a JIT-based PHP virtual machine. Issues associated with HPHPc included reaching a plateau for further performance improvements, a fundamental inability to support all features of the PHP language, and difficulties arising from specific time- and resource-consuming development and deployment processes. In Q1 2013, the production version of the facebook.com website stopped using HPHPc and switched to HHVM.
Following the JIT compilation principle, HHVM first converts the executed code into an intermediate language, the high-level bytecode HHBC. HHBC is a bytecode format created specifically for HHVM, appropriate for consumption by both interpreters and just-in-time compilers. Next, HHVM dynamically ("just-in-time") translates the HHBC into x86-64 machine code, optimized through dynamic analysis of the translated bytecode. Finally, it executes the x86-64 machine code. As a result, 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 in comparison with HPHPc. HHVM uses the same execution engine when deployed in both production and development environments, while supporting integration between the execution engine and the HPHPd debugger in both environment types; as a result, maintaining HPHPi (HipHop interpreter) separately as a development utility is no longer needed as it was the case with HPHPc. HHVM also eliminates the lengthy builds required by HPHPc to run programs, resulting in much simpler development and deployment processes than it was the case with HPHPc. Finally, versions of HHVM before 4.0 have almost complete support for the entire PHP language (as defined by the official implementation of PHP version 5.4), including the support for the
eval() constructs, which was impossible with HPHPc.
Together with HHVM 3.0, Meta also released Hack, a derivative of PHP that 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, Hack does not provide complete backward compatibility since it removes several PHP features, such as the
goto statement and dynamic variable names.
In September 2017, it was announced that version 3.30 would be the last version of HHVM to officially support PHP, and that HHVM will only support Hack going forward. This was due to differences and incompatibilities in PHP 7. HHVM 4.0, released in February 2019, was the first version without support for PHP.
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 a higher web server throughput and lower latency. In Q4 2012, the execution of facebook.com's source code on HHVM achieved performance parity with HPHPc, and in December 2013 HPHPc was even surpassed by around 15%.
- Jason Evans (December 9, 2011). "The HipHop Virtual Machine". Meta Platforms. https://www.facebook.com/notes/facebook-engineering/the-hiphop-virtual-machine/10150415177928920.
- "Releases · facebook/hhvm". Facebook. 2022-04-20. https://github.com/facebook/hhvm/releases/tag/HHVM-4.158.0.
- "Building and installing HHVM on CentOS 7.x". Meta Platforms. May 26, 2015. https://github.com/facebook/hhvm/wiki/Building-and-installing-hhvm-on-CentOS-7.x.
- "Building the Hack typechecker". Meta. September 10, 2014. https://github.com/facebook/hhvm/wiki/Building%20the%20Hack%20Typechecker.
- "Facebook's HHVM Begins Seeing Rust Rewrite - Phoronix". https://www.phoronix.com/scan.php?page=news_item&px=Facebook-Rust-HHVM.
- "facebook/hhvm: License". Facebook, Inc.. https://github.com/facebook/hhvm#license.
- Ottoni, Guilherme (June 20, 2018). "HHVM JIT: A Profile-Guided, Region-Based Compiler for PHP and Hack". ACM. pp. 151–165. https://dl.acm.org/citation.cfm?id=3192374.
- "facebook/hhvm". Meta Platforms. https://github.com/facebook/hhvm.
- Kaushik Pal (April 28, 2014). "PHP and Zend Engine Internals". http://www.phpbuilder.com/articles/application-architecture/optimization/php-and-zend-engine-internals.html.
- HHVM source code on GitHub
- Drew Paroski (November 29, 2012). "Speeding up PHP-based development with HHVM". Meta Platforms. https://www.facebook.com/notes/facebook-engineering/speeding-up-php-based-development-with-hiphop-vm/10151170460698920.
- "Announcement on GitHub removing HPHPc support". Meta Platforms. February 19, 2013. https://github.com/facebook/hiphop-php/commit/fc5b95110ff75110ad55bb97f7c93a8c4eb68e3b.
- "HipHop Bytecode v1 revision 18". Meta Platforms. July 31, 2014. https://github.com/facebook/hhvm/blob/master/hphp/doc/bytecode.specification.
- "facebook/hhvm: About upgrade to PHP 5.4 engine". May 2013. https://github.com/facebook/hiphop-php/issues/716.
- "facebook/hhvm: Home". Meta Platforms. May 8, 2014. https://github.com/facebook/hhvm/wiki.
- "HHVM 3.0.0". Facebook. March 28, 2014. https://hhvm.com/blog/4349/hhvm-3-0-0.
- Cade Metz (March 20, 2014). "Facebook Introduces 'Hack,' the Programming Language of the Future". Wired. https://www.wired.com/wiredenterprise/2014/03/facebook-hack/. Retrieved April 15, 2014.
- "Hack: a new programming language for HHVM". Facebook. April 2014. https://code.facebook.com/posts/264544830379293/hack-a-new-programming-language-for-hhvm/.
- Josh Lockhart (April 3, 2014). "Facebook's Hack, HHVM, and the future of PHP". O'Reilly Media. http://radar.oreilly.com/2014/04/facebooks-hack-hhvm-and-the-future-of-php.html.
- "Hack and HHVM: Type Annotations (Hack Manual)". http://docs.hhvm.com/manual/en/hack.annotations.php.
- "Hack and HHVM: Type Inference (Hack Manual)". http://docs.hhvm.com/manual/en/hack.otherrulesandfeatures.typeinference.php.
- "Hack and HHVM: Unsupported PHP Features in Hack (Hack Manual)". http://docs.hhvm.com/manual/en/hack.unsupported.php.
- Fred Emmott (September 12, 2018). "Ending PHP Support, and The Future Of Hack". https://hhvm.com/blog/2018/09/12/end-of-php-support-future-of-hack.html.
- Krill, Paul (2017-09-20). "Forget PHP! Facebook's HHVM engine switches to Hack instead" (in en). https://www.infoworld.com/article/3226489/web-development/forget-php-facebooks-hhvm-engine-switches-to-hack-instead.html.
- Fred Emmott (February 11, 2019). "HHVM 4.0.0". https://hhvm.com/blog/2019/02/11/hhvm-4.0.0.html.
- "We are the 98.5% (and the 16%)". December 19, 2013. http://www.hhvm.com/blog/2813/we-are-the-98-5-and-the-16.
Original source: https://en.wikipedia.org/wiki/HHVM. Read more