HHVM support

**This is a work in progress**

This PR is not meant to be merged as is: I use it to check where and how we can fix compatibility issues with HHVM.

Some of the patch submitted here are not OK to me (especially 5dde3dc).
If you have others suggestions to fix compatibility issues, feel free to send patches on this branch.