Jump to content

HHVM: Difference between revisions

From Wikipedia, the free encyclopedia
Content deleted Content added
rm spam
No edit summary
Line 6: Line 6:
| logo alt = HHVM logo, featuring white uppercase "HHVM" letters on a black background, with stylized triangular geometric shapes on the left
| logo alt = HHVM logo, featuring white uppercase "HHVM" letters on a black background, with stylized triangular geometric shapes on the left
| logo caption =
| logo caption =
| developer = [[Facebook]]
| developer = [[Facebook, Inc.]]
| released = {{Start date and age|2011|12|09}}<ref name="initial-release">{{cite web
| released = {{Start date and age|2011|12|09}}<ref name="initial-release">{{cite web
| url = https://www.facebook.com/notes/facebook-engineering/the-hiphop-virtual-machine/10150415177928920
| url = https://www.facebook.com/notes/facebook-engineering/the-hiphop-virtual-machine/10150415177928920
Line 23: Line 23:
| title = Building the Hack typechecker
| title = Building the Hack typechecker
| date = {{date|2014-09-10|mdy}} | accessdate = {{date|2015-06-12|mdy}}
| date = {{date|2014-09-10|mdy}} | accessdate = {{date|2015-06-12|mdy}}
| publisher = [[Facebook]] | website = github.com
| publisher = Facebook | website = github.com
}}</ref>{{Efn|Only the [[Hack (programming language)|Hack]]'s [[Data type|type]]-checking ({{Mono|hh_server}} and {{Mono|hh_client}}) and code-formatting ({{Mono|hh_format}}) [[Command-line utility|command-line utilities]] and [[Daemon (computing)|daemons]] bundled together with the HipHop Virtual Machine are written in [[OCaml]].}} and [[Rust (programming language)|Rust]]<ref>{{cite web |title=Facebook's HHVM Begins Seeing Rust Rewrite - Phoronix |url=https://www.phoronix.com/scan.php?page=news_item&px=Facebook-Rust-HHVM |accessdate=29 August 2019}}</ref>
}}</ref>{{Efn|Only the [[Hack (programming language)|Hack]]'s [[Data type|type]]-checking ({{Mono|hh_server}} and {{Mono|hh_client}}) and code-formatting ({{Mono|hh_format}}) [[Command-line utility|command-line utilities]] and [[Daemon (computing)|daemons]] bundled together with the HipHop Virtual Machine are written in [[OCaml]].}} and [[Rust (programming language)|Rust]]<ref>{{cite web |title=Facebook's HHVM Begins Seeing Rust Rewrite - Phoronix |url=https://www.phoronix.com/scan.php?page=news_item&px=Facebook-Rust-HHVM |accessdate=29 August 2019}}</ref>
| operating system =
| operating system =
Line 31: Line 31:
| title = facebook/hhvm: License
| title = facebook/hhvm: License
| accessdate = {{date|2014-08-02|mdy}}
| accessdate = {{date|2014-08-02|mdy}}
| publisher = [[Facebook]] | website = github.com
| publisher = [[Facebook, Inc.]] | website = github.com
}}</ref>
}}</ref>
| website = {{URL|https://hhvm.com|HHVM.com}}
| website = {{URL|https://hhvm.com|HHVM.com}}
Line 49: Line 49:
| title = facebook/hhvm
| title = facebook/hhvm
| accessdate = {{date|2014-08-02|mdy}}
| accessdate = {{date|2014-08-02|mdy}}
| publisher = [[Facebook]] | website = github.com
| publisher = Facebook | website = github.com
}}</ref> This contrasts with PHP's usual [[Interpreted language|interpreted]] execution, in which the [[Zend Engine]] transforms PHP [[source code]] into [[opcode]]s that serve as a form of [[bytecode]], and executes the opcodes directly on the Zend Engine's virtual [[CPU]].<ref>{{cite web
}}</ref> This contrasts with PHP's usual [[Interpreted language|interpreted]] execution, in which the [[Zend Engine]] transforms PHP [[source code]] into [[opcode]]s that serve as a form of [[bytecode]], and executes the opcodes directly on the Zend Engine's virtual [[CPU]].<ref>{{cite web
| url = http://www.phpbuilder.com/articles/application-architecture/optimization/php-and-zend-engine-internals.html
| url = http://www.phpbuilder.com/articles/application-architecture/optimization/php-and-zend-engine-internals.html
Line 62: Line 62:
}}</ref>
}}</ref>


HHVM is developed by [[Facebook]], with the project's source code hosted on [[GitHub]]; it is licensed under the terms of the [[PHP License]] and [[Zend License]].<ref name="initial-release" /><ref name="license" />
HHVM is developed by [[Facebook, Inc.|Facebook]], with the project's source code hosted on [[GitHub]]; it is licensed under the terms of the [[PHP License]] and [[Zend License]].<ref name="initial-release" /><ref name="license" />


== Overview ==
== Overview ==

Revision as of 04:06, 29 March 2020

HHVM
Developer(s)Facebook, Inc.
Initial releaseDecember 9, 2011; 12 years ago (2011-12-09)[1]
Repository
Written inC++[2], OCaml[3][a] and Rust[4]
LicensePHP License and Zend License[5]
WebsiteHHVM.com

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 and used to support PHP execution before the release of HHVM version 4.[6] 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.[7][8] 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.[9]

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

Overview

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.[10][11] Based on the gained experience and aiming to solve issues introduced by HPHPc, Facebook decided in early 2010 to create a JIT-based PHP virtual machine. Issues associated with HPHPc included its reaching of a plateau for further performance improvements, lack of full support for all features of the PHP language, and difficulties arising from specific time- and resource-consuming development and deployment processes required for PHP projects that used HPHPc.[10] 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 PHP or Hack code into a high-level bytecode, HHBC, which is also known as an intermediate language. HHBC is a bytecode format created specifically for HHVM, in a form that is appropriate for consumption by both interpreters and just-in-time compilers. As the next steps in execution, HHVM dynamically ("just-in-time") translates the HHBC bytecode into x86-64 machine code, performs its additional optimizations through a dynamic analysis of the translated bytecode, and executes the x86-64 machine code.[1][10][12] 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, and one of them is almost complete support for the entire PHP language as defined by the official implementation of PHP version 5.4, including the HHVM's support for create_function() and eval() constructs.[13][14] Furthermore, 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 PHP programs, resulting in much simpler development and deployment processes than it was the case with HPHPc.[1]

Together with HHVM, Facebook also released Hack, a derivative of PHP[15][16] that allows programmers to use both dynamic typing and static typing, which is 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 provide complete backward compatibility by not carrying on some of the PHP features, such as the goto statement and dynamic variable names.[17][18][19][20]

In September 2017, it was announced that version 3.24 would be the last version of HHVM to officially support PHP, and that HHVM will only support Hack going forward, citing differences and incompatibilities in PHP 7.[21]

Performance

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,[10] and in December 2013 HPHPc was even surpassed by around 15%.[22]

See also

Notes

  1. ^ Only the Hack's type-checking (hh_server and hh_client) and code-formatting (hh_format) command-line utilities and daemons bundled together with the HipHop Virtual Machine are written in OCaml.

References

  1. ^ a b c d Jason Evans (December 9, 2011). "The HipHop Virtual Machine". Facebook. Retrieved August 2, 2014.
  2. ^ "Building and installing HHVM on CentOS 7.x". github.com. Facebook. May 26, 2015. Retrieved June 12, 2015.
  3. ^ "Building the Hack typechecker". github.com. Facebook. September 10, 2014. Retrieved June 12, 2015.
  4. ^ "Facebook's HHVM Begins Seeing Rust Rewrite - Phoronix". Retrieved August 29, 2019.
  5. ^ a b "facebook/hhvm: License". github.com. Facebook, Inc. Retrieved August 2, 2014.
  6. ^ https://hhvm.com/blog/2019/02/11/hhvm-4.0.0.html
  7. ^ Ottoni, Guilherme (June 20, 2018). "HHVM JIT: A Profile-Guided, Region-Based Compiler for PHP and Hack". Proceedings of the 39th ACM SIGPLAN Conference on Programming Language Design and Implementation (PLDI). ACM. pp. 151–165.
  8. ^ "facebook/hhvm". github.com. Facebook. Retrieved August 2, 2014.
  9. ^ Kaushik Pal (April 28, 2014). "PHP and Zend Engine Internals". phpbuilder.com. Archived from the original on September 15, 2014. Retrieved September 23, 2014.
  10. ^ a b c d Drew Paroski (November 29, 2012). "Speeding up PHP-based development with HHVM". Facebook. Retrieved August 2, 2014.
  11. ^ "Announcement on GitHub removing HPHPc support". github.com. Facebook. February 19, 2013. Retrieved May 24, 2013.
  12. ^ "HipHop Bytecode v1 revision 18". github.com. Facebook. July 31, 2014. Retrieved May 24, 2013.
  13. ^ "facebook/hhvm: About upgrade to PHP 5.4 engine". github.com. May 2013. Retrieved August 2, 2014.
  14. ^ "facebook/hhvm: Home". github.com. Facebook. May 8, 2014. Retrieved August 2, 2014.
  15. ^ Cade Metz (March 20, 2014). "Facebook Introduces 'Hack,' the Programming Language of the Future". Wired. Retrieved April 15, 2014.
  16. ^ Julien Verlaguet; Alok Menghrajani (April 2014). "Hack: a new programming language for HHVM". code.facebook.com. Facebook. Retrieved March 23, 2014.
  17. ^ Josh Lockhart (April 3, 2014). "Facebook's Hack, HHVM, and the future of PHP". O'Reilly Media. Retrieved August 2, 2014.
  18. ^ "Hack and HHVM: Type Annotations (Hack Manual)". docs.hhvm.com. Retrieved March 25, 2014.
  19. ^ "Hack and HHVM: Type Inference (Hack Manual)". docs.hhvm.com. Archived from the original on March 26, 2014. Retrieved March 25, 2014.
  20. ^ "Hack and HHVM: Unsupported PHP Features in Hack (Hack Manual)". docs.hhvm.com. Retrieved April 2, 2014.
  21. ^ Krill, Paul (September 20, 2017). "Forget PHP! Facebook's HHVM engine switches to Hack instead". InfoWorld. Retrieved February 6, 2019.
  22. ^ "We are the 98.5% (and the 16%)". hhvm.com. December 19, 2013. Retrieved August 2, 2014.