PPC64 / hhvm

A virtual machine designed for executing programs written in Hack and PHP.
http://hhvm.com
Other
4 stars 3 forks source link

RFC: Improvements to codegen #143

Closed daxtens closed 8 years ago

daxtens commented 8 years ago

This PR contains some draft patches that improve performance of generated code (and one small optimisation of the core). Each patch has a comprehensive description of what it does.

In short, the preparation for unsigned comparisons meant that every comparison was done twice, and that there was a move from and move to CR for each arithmetic operation that set flags. This add an optimisation pass that looks forwards to what branches are required, then only emits the comparison/copy operations when required.

The improvements are pretty good: ~9% for MediaWiki and 26% for a microbenchmark.

However, the changes are quite intrusive, and affect 'generic' vasm code. So there is probably a much better way to get the same result, and I'm hoping you guys have some ideas. (Or if you think FB would take it regardless of the mess, that would also be good to know!)

racardoso commented 8 years ago

This is a really nice work. I'll merge you work and check this. Thanks.