Looking for more information on how to do PHP the right way? Check out PHP: The Right Way

HHVM Blog:
LLVM Code Generation in HHVM
Oct 29, 2015 @ 17:08:22

In this post to the HHVM blog they answer a common question they get from the development community: why don't they use LLVM for code generation when compiling down the PHP.

The primary reason has always been that while LLVM is great at optimizing C, C++, Objective-C, and other similar statically-typed languages, PHP is dynamically typed. The kinds of optimizations that provide huge performance benefits for static languages tend to be less useful in dynamic languages, or at least overshadowed by all the dynamic dispatching that’s done based on runtime types. We knew that there was probably something to be gained from using LLVM as a backend, but there were many larger opportunities go after first.

They talk about the compilation pipeline HHVM uses and shows the difference between how it works versus how LLVM would integrate into the final steps. They also talk about the work put in to explore the use of LLVM IR and what kind of changes they had to make to support it. This includes updates to PHP function call handling, generalizing vasm and updates to the LLVM tool itself (with changes to location records, smashable calls and performance tweaks among others).

tagged: hhvm llvm code generation compilation changes updates support

Link: http://hhvm.com/blog/10205/llvm-code-generation-in-hhvm


Trending Topics: