Hack Community Roundup #3

Posted on August 21, 2014 by

As always, I’m really excited to see what our community has been building and saying, and really exited to share what I’ve seen with everyone!

Hack logo

Github Projects

Blog Posts / Other

Posted in Hack Language | Leave a reply



Announcing a specification for PHP

Posted on July 30, 2014 by

PHP-logo

The PHP language has been around for over 20 years and is clearly one of the most popular programming languages in the world. PHP is definitely the lingua-franca of the internet for server-side web programming.

While there is extensive user-documentation, the PHP language has always been missing a language specification. That is not to say a specification hasn’t been thought about or discussed. It is just that one has never really come to fruition.

The Chinese philosopher Lao Tzu stated “A journey of a thousand miles begins with a single step”. We are excited to announce the initial draft of a specification for PHP.

The existence of the specification was announced by Sara at OSCON 2014. The feedback to the announcement and the sample chapter was overwhelmingly positive.

And now, the entirety of the initial draft specification has been released to the world. It is hosted on a git repository at php.net and this repo will be mirrored to GitHub. Please have a read through the specification. Provide your pull requests and feedback. We hope and expect that this specification will evolve over time with the help of everyone who cares about the PHP language.

Thank you to the PHP group for taking the mantle and providing the infrastructure for hosting the further development of the specification and helping shepherd this as a truly community-owned and developed project.

Special thanks must be given to Rex Jaeschke, who lead the actual writing of the specification, and Drew Paroski, who was pivotal in the review effort and helped Rex shape the spec into its initial form. Thanks to Paul Tarjan, Sara Golemon, Fred Emmott, Josh Watzman and the rest of the HHVM team for their awesome contributions and feedback. And thank you to Stanislav Malyshev and Nikita Popov, who had an early look at the specification and provided valuable feedback.

Language specifications may not be flashiest things in the world of programming, but, in my humble opinion, this is an exciting day for the PHP language. Read on!!

Posted in Announcement | Leave a reply



HHVM 3.2.0

Posted on July 23, 2014 by

The next version of HHVM is out (well it came out 6 days ago, I’ve just been at OSCON all week and haven’t had a chance to do this post).

Some of the highlights:

  • The other 100 bugfixes from our last lockdown.
  • hh_client and hh_server now build on OSX and don’t need .hhi files.
  • fastcgi params are now in $_SERVER.
  • $php_errormsg works.
  • PHP_VERSION now is 5.6.

Security Fixes:

Full HHVM Changelog:

LL_Cool_J_2013 440px-Mos_Def_-_Ilosaarirock_2012 440px-OutKast_2001 The_Notorious_B.I.G

“Outkast” 17-July 2014
- PHP_VERSION is now 5.6
- Introduce Dbl specific relational IR opcodes
- Expose APC info to admin port
- Improve Zend compatibility in the reflection API
- Implement xdebug_call_class
- Hack: first version of formatter
- Convert ext/xsl to HNI
- Hack: improve init time
- Remove JIT::RuntimeType
- Fix floating-point overflow for binary, octal and hex literals
- Collections: Vector::addAllKeysOf
- Hack can build on OSX now
- Fix await/yield operator precedence
- Fix various xcontroller issues
- Enable HHIRBytecodeControlFlow by default
- Various changes/fixes to WholeCFG region selector
- Introduce async generators
- Kill clock_settime
- Fix Memcache::get($keys) when $keys is an array
- Implement xdebug_call_function
- Change order of wait handle processing from FIFO to LIFO
- Add Redis::_serialize()

“Notorious B.I.G.” 25-Jun-2014
- Remove Translator::analyze (replaced by tracelet region selector)
- Allow empty keys in hash_hmac() and hash_hmac_file()
- Interface requirements supported in parser
- Implement xdebug_{peak_,}memory_usage
- Inline singleton-pattern functions
- Cleanup in PhpFile and FileRepository
- Fix mysqli_query return value for query without result
- Implement xdebug_call_file
- Add fastlz support to memcached extension
- Fix ini_get to return false for non-supported settings
- Fix PHP version constants
- All numeric comparisons involving NAN, except != and !==, are now false.
- Implement xdebug_call_line
- Optimize ini_get
- Remove dump-file-repo admin command
- Fix stdclass promotion of static private properties
- Remove unused locals in global dce (HHBBC)
- Get mockery at 100%
- Fix casting resource to object
- Relocate code to arbitrary alignment
- Always let the first character through for camelcase searching
- Implement xdebug configuration options
- Convert ext/memcache to HNI
- Match php5′s memcache getoption
- ./configure –help now has all the options
- mysqli: return false on non-selects
- Don’t include bt_handler or killpg in backtraces
- Don’t buffer overrun on bad DNS TXT records
- Fixed property access to DOM and XMLReader classes
- Add support for ParamCoerceModeFalse

“Mos Def” 11-Jun-2014
- Turn on new tracelet region selector by default; analyze() is deprecated
- Fix a bug in debugBacktrace with NativeImpl methods
- Request local allocator now uses logarithmically spaced size classes
- Improvements to JIT’d FCallBuiltin to cause fewer spills
- Enable vtable-style dispatch on methods marked “abstract”
- JIT several instructions that were being punted: Unbox, File, Dir
- Increase “hinted drop” time on write lease, improving JIT’d code layout
- Implemented __toString functions in reflection classes
- Several tc-print bug fixes
- Some improvements in hhbbc arithmetic type inference
- More service requests are “ephemeral”, reducing wasted stubs space
- HH\Vector now has a packed array internally, for O(1) conversions to array
- current() and key() now support expressions that can’t be taken by reference
- Fix a long-standing but very rare race condition with Closure class names
- gcc 4.8 is the new minimum to build
- Various bug/compat fixes in Soap, SimpleXML, ArrayObject, DOMNode, mysqli
- Add a scheme to extend support for efficient packed arrays w/ cap up to 2^32
- Move vmfp, vmsp, and vmpc into RDS
- Fix some hard-to-hit bugs in inlining relating to stack overflow checks
- Faster int to double conversion when calling builtins from the JIT
- Fix ReflectionParameter::getClass for scalar typehints
- better tuning of the PGO ‘hot function’ threshold
- performance improvements to calling native class methods
- improve performance of async functions that exit via exception
- several bug fixes in refcount optimization pass relating to async functions
- More hhir-related docs in the hackers-guide
- Initial support for relocating generated machine code
- JIT optimizations for count()
- Corrected the result of var_dump and print_r for ArrayObject
- fix HH\autoload_set_paths with nested maps
- make ReflectionClass serializable
- ext/standard/output HNI conversion
- allow usage of zend-qsort in user sorts with a runtime option

“LL Cool J” 28-May-2014
- Over 200 other bug fixes (go lockdown!)
- Every HDF setting is now available as INI
- Cut session_id() size by 1/2
- Added ‘Z’ format string for pack/unpack
- We now build on clang
- Fix pcre cache to not fatal when full
- Implement $php_errormsg
- Adding -n CLI option to hhvm php mode
- Fix substitution of invalid UTF8 sequences in htmlspecialchars
- FastCGI: Use SCRIPT_FILENAME as the PHP script to run
- Can create DateTimeZone’s from abbreviations
- Put all fastcgi params into $_SERVER
- Many DOM classes are now serializable
- Define the xhp tokens
- Many reflection changes for perf and compatibility
- Default fastcgi to listen on 127.0.0.1
- remove register_cleanup_function
- Map: reserve()
- Set: retain(), reserve(), addAllKeysOf()
- {Set|ImmSet|Vector|ImmVector}::fromKeysOf()

Posted in Announcement | Leave a reply



Faster GitHub Commits

Posted on July 8, 2014 by

The HHVM community is awesome, particularly when it comes to directly helping us fix HHVM through pull requests. Until now, the actual pushing of commits (both our internal code and your pull requests) back to the master HHVM branch on GitHub has been a manual process, and takes more time than we would prefer (and I am sure may have frustrated you from time to time).

Initially, the entire process was manual. We would curl the pull request and pipe it to git am, then manually prepare the diff for review internally. After it was accepted, we would manually prepare the internal commit to be usable externally by GitHub, then manually build and test the new code, and finally git push.

Great scripts by ptarjan and sgolemon to help get and prepare pull requests for review and then prepare the commits for GitHub have alleviated some of this manual process. However, in the end, someone still had to manually build, test and then push the code to the world.

We are moving just a bit faster....

We are moving just a bit faster….

Those that keep track of the HHVM GitHub repo may have noticed a higher frequency of commits being pushed than in the past. This is not due to someone having too much time on their hands; we are all still very busy hopefully making HHVM better. Instead, we have set up what generally amounts to a sophisticated cron job where a user called facebook-github-bot pushes any new internal HHVM code to GitHub every 30 minutes. So, once your pull request has been accepted and committed internally, your code should be live on GitHub in, at most, 30 minutes later (unless the job catches a failure, like a build error). In addition, this also allows the individual diffs that we write internally to be pushed to you much faster, closer to real-time, instead of in one sweeping push with a bunch of the day’s diffs.

This job syncs all new code from the time of the last GitHub commit, does some git commit message housekeeping to prepare it for GitHub, builds and tests the code automatically, and, assuming all went well in those previous steps, pushes the code to the master branch.

Not every pull request is accepted. And there are times when pull requests take a while to get reviewed (either due to issues with the code changes in general or with issues internally on our end). However, we hope those cases are the exceptions. We want to accept as many pull requests as provided to us (either as-is or with some modification). And we believe that getting your code into the master branch quickly will hopefully help show how much we appreciate your contributions.

Now, if there was only a way we could get your pull requests reviewed faster and more openly…. Hmmm… ;)

Posted in FYI | Leave a reply



Hack Community Roundup #2

Posted on June 25, 2014 by

Since the last roundup, our community has continued to produce some really cool projects using Hack. I’m really excited to have another long list to share with all of you!

Hack logo

Github Projects

Blog Posts / Other

  • The Hack team and knowledgeable community members monitor the StackOverflow tag “hacklang” for questions, and we’ve gotten some good ones. In particular, I loved this question about converting some PHP code to Hack. It’s an extremely good question about thinking about how to write well-structured Hack strict-mode code; make sure to read the author’s comment on my answer about why the author’s code was structured that way.
  • In the same vein, as part of his groundwork framework rewrite mentioned above, Nathan Davidson wrote a great blog post about his experience with the conversion, including some insightful discussion of the finer points of a Hack conversion and what it means to be well-typed.
  • Knecht Rootrecht has started a German language Hack forum.

One reminder for anyone thinking of starting a new project in Hack: the type system itself is enforced by a separate typechecker, not by HHVM itself, so make sure you follow the directions on getting it set up, otherwise you’re missing out on a huge amount of the power of Hack!

Leave your thoughts down in the comments. In particular, please let me know what I’ve missed so I can feature it in the next post!

Posted in Hack Language | Leave a reply



HHVM 3.1.0

Posted on May 29, 2014 by

The next version of HHVM is hot off the press. After a few delays, we finally tracked down the segfault. We fixed it in master, but turning off the optimizations was safer for the release. Thanks for your patience.

This release bisected our semi-annual lockdown. If you remember last time we focused on framework unit tests, performance, and growing beards. This time, our frameworks were in good shape thanks to Fred and our Open Academy students, but our github story was not as pretty. At the start of lockdown we had 60 pull requests and nearly 450 issues. So our focus this time was github health and of course as always, perf.

Our final results from lockdown were, drumroll … 251 closed issues and 16% more efficient on large workloads. The 3.1.0 release timing was a bit unfortunate by bisecting our lockdown, so only 1/3 of the fixes and perf is in there. The few weeks after lockdown are always a little unstable and we didn’t want to push the release out any longer, so you get some of the awesomeness this time and the other bunch in the next release.

Some of the highlights:

  •  Support for PHP 5.6 variadic ...$args syntax for func declarations. We’re closing in on all the PHP 5.6 features. We just have splat left to build, and we’re working on it. Go ahead and bug Eugene on IRC so we can bump our PHP_VERSION up.
  • There is now over 400 ini settings you can use to configure various things. Most of them aren’t important but anything you were using a .hdf file for, you should be able to port over. We’ll work on the documentation (you can too, just click edit).
  • The Zend extension compatibility layer is getting much better thanks to tons of work by Tim Starling. Try it on your PHP5 extension and open an issue if it doesn’t work.

Security Fixes:

Full HipHop Changelog:

House of PHPain Insane Poetry Jay-Z Kanye West
“Kanye West”
- Backport fix for CVE-2011-2202
- Interfaces {Keyed}Container match arrays *and* collections, not iterables
- Added ** and **= operators to HHVM and more compatibility fixes with PHP5.6
- Fixes and improvements to collections
- Replace json decoder with json-c library
- Document VMRegAnchor and isVMFrame()
- Improvements to array iterator code
- Improvements to the type checker
- Allow parser to be generated with bison 3
- Improvements and speed up to reflection code

“Jay-Z” 9-May-2014
- Make handling of code.hot overflows more robust
- Catch server errors sooner
- Fix segfault and infinite recursion in fileinfo extension
- Resolve systemlib constants at compile time
- Resume resumables natively
- Import round() table optimizations from php-src
- Delete bytecode Peephole optimizer
- Remove most of annotation.cpp, and some other code gated on !UsedHHBBC
- Create phis for locals
- Fix free of “” in rfc1867PostHandler
- Add firstValue(), firstKey(), lastValue(), lastKey() to collections
- Add concat() to collections
- Clarify Hack license
- Add CakePHP3 to test runner
- Better error when TC is full
- Add hash_equals() from PHP 5.6

“Insane Poetry” 24-Apr-2014
- Support for PHP 5.6 variadic …$args syntax for func declarations
- Open source HHMeasure, a simple and extensible microbenchmarking tool
- Added a new time-based sampling profiler (Project Xenon)
- Fix PCRE unicode handling
- Convert Zend compatibility layer and various extensions to HNI
- Encode execution mode (eager or resumed) into SrcKey
- Merge eager and resumed parts of async functions
- Rework various async / continuation bytecode instructions

“House of PHPain” 1-Apr-2014
- Allow direct arg passing with up to 15 params (7 if at least one is a double)

Posted in Announcement | Leave a reply



Hack Community Roundup

Posted on May 9, 2014 by

In the weeks since the Hack open source launch and the Hack developer day, there has been a lot of information, code, blog posts, etc coming from our nascent community. To us on the team, it’s been incredible and encouraging to see the community reception to Hack. Here are some of the highlights of the things we’ve seen come out of our community. (And we almost certainly haven’t seen everything, so please let us know in the comments what we’ve missed!)

Hack logo

Github Projects

  • The folks at PocketRent, some of the earliest adopters of Hack, have a small Hack framework. Even if you aren’t interested in using it directly, there are great examples of everything from XHP to async functions.
  • Victor Berchet has released a Vagrant configuration to help get HHVM and Hack up and running in a VM as quickly as possible. Many folks have had trouble getting HHVM and Hack up and running, and while we’re trying to improve that process moving forward, if you’re one of those folks, you may want to give it a try.
  • Emre Sokullu built and released hack-mvc, a small MVC framework for Hack. He also wrote a blog post discussing his motivation behind using HHVM and Hack.
  • Brian Scaturro has begun work on HackUnit, an xUnit testing framework written in Hack.
  • For deployment, the folks at Heroku have first-class support for HHVM and Hack, and have contributed instructions to our Hack example site on how to get it running on Heroku.

Presentations

Blog Posts

Again, thanks to everyone who has created the information above, and to everyone who is already trying Hack. I’ve personally always been excited for what this technology could do to improve developers’ lives, and am looking forward to helping to grow the fledgling Hack community.

Posted in Hack Language | Leave a reply



Compatibility Update

Posted on April 21, 2014 by

Earlier this year we set an ambitious goal of passing the PHPUnit test suites of 20 popular frameworks by the end of June; at the time, we were passing on only 6! With a huge amount of help from the community (especially our OpenAcademy students), we’re proud to have hit this goal more than 2 months early, and we have more frameworks expected to reach 100% shortly.

lotsoflogos

The full list (currently 23) is shown on our framework tests page; we consider the following to be popular, and will be supported in HHVM 3.1, and our nightly builds:

  • assetic
  • codeigniter
  • composer
  • doctrine2
  • facebookphpsdk
  • guzzle3 (guzzle4 coming soon)
  • idorm + paris
  • laravel
  • lessphp – thanks to Camillus Gerard Cai
  • mediawiki
  • mockery
  • monolog – thanks to Rafe Kettler
  • mustache – thanks to Kevan Fisher
  • phpbb3 – thanks to Kevan Fisher
  • phpmyadmin – thanks to Jeff Chan
  • phpunit
  • ratchet – thanks to Kevan Fisher
  • reactphp – thanks to Camillus Gerard Cai
  • slim
  • twig

Special thanks to Ioan Negulescu for improving our Symfony support, and to Joel Low for several fundamental improvements to HHVM helping all of us, and for bringing Drupal 8′s PHPUnit tests to 100% –  Drupal 8 is not included in the list above as the PHPUnit tests are a small portion of their full test suite.

What’s next? Compatibility is still a huge priority for us, though we feel that targeting framework test suites has run its course and gotten us most of the low hanging fruit. After we’ve finished support for a few more frameworks that are nearly complete, we’re going to refocus on fixing issues reported on GitHub. HHVM now has a great overall level of support for PHP5, and we think the best way to continue to improve it is to work on the issues that you and the rest of our community are finding in the real world. If you find compatibility problems, please open an issue and we’ll fix it as soon as we can. We are starting on anything tagged hi-pri and working down from there. Ask for a priority bump if your issue is blocking your HHVM deployment.

Posted in FYI, Parity | Leave a reply



Hack Developer Day 2014: Keep Hacking

Posted on April 10, 2014 by

A few weeks ago, the Hack language was launched to the world. Yesterday, we held the first Hack Developer Day in Menlo Park, California. 150+ Members of the PHP and developer community came to Facebook headquarters and joined over 2000 people online for presentations by the engineers of Hack and HHVM. Afterwards we held a five hour hackathon, where the attendees worked with those engineers to write Hack code, either by converting current codebases or writing new code from scratch. By the way, bonus points to anyone who can decrypt the commit message used when Josh originally pushed Hack to open source.

For those who couldn’t attend, here are the videos of all the presentations…

… and click here for the PDFs of the slides.

There is an official recap of the event on the Facebook Engineering blog, but let me try to provide you a few points that really resonated with me, and I hope many of the attendees:

  • We really strived to make Hack as unobtrusive as possible by providing a lot statically typed functionality without negatively impacting your fast workflow.
  • Hack features like Collections and async/await were received very well and I believe will end up being an integral part of a Hack developer’s toolbox.
  • Tools such as the Hackificator, while not a panacea, can really help you with code conversions.
  • We are working super hard to make HHVM a really great runtime for PHP. Just check out our frameworks compatibility page to understand how serious we are.
  • Our community is awesome. Plain and simple. And we want to make working with Hack and HHVM awesome for them. So we are doing all we can to be even more open (e.g., we are implementing an open review process; bye-bye pull requests).
  • Let it not be forgotten that we are always trying to make HHVM more efficient and run your code faster.
  • FBIDE is really nice, and can make learning and using Hack so much easier. I am really looking forward to its release. What is FBIDE, you might ask? See the video or recap to learn more about this nugget of information.

Simply put, the day was good times all around. And, as one attendee put it, “Keep Hacking!”

Posted in FYI, Hack Language | Leave a reply



Debug Packages

Posted on April 7, 2014 by

We try our best to be a stable dependable runtime, but if you are reaching into the deep dark abyss of the PHP language, you might stumble upon a dark corner where we segfault or assert. First of all, we are sorry. Secondly, we would love you to report the issue, and if you can put together a small test case that is best. If it only reproduces under the full moon when you hold your head to the side and hop on one leg, then a stacktrace would be next best.

Before today, you had to compile the code by hand to get a useful stack trace. No longer! Using the same repo you normally use, add -dbg to the name of your package.

sudo apt-get install hhvm-dbg  # old faithful
sudo apt-get install hhvm-nightly-dbg  # the new hotness

The package is much larger, slower and has a bajillion asserts in it, so please don’t use it in production. Please DO use it for reporting stack traces and for diving into HHVM with gdb. Happy debugging.

Posted in Uncategorized | Leave a reply