Hackathon: initial version of php-to-hhas printer

Reviewed By: @edwinsmith

Differential Revision: D1099109
Revert "[ext_asio] Process ready wait handles in LIFO rather than FIFO order"

This reverts commit ff25227dea707166baf9fcb14a4940d503252e5f.

This has been reverted in 4 releases. That is just unacceptable. Please don't commit this until it can go out with a release.

Reviewed By: @jano

Differential Revision: D1102064
make filter_var snapshot the variables at request start

I made an extensible way for extensions to run some code at the start of every request.

Reviewed By: @alexmalyshev

Differential Revision: D1101191
Fix bugs in SetOpL

I ran into these while trying a perf diff that didn't turn out to help perf.

Reviewed By: @swtaarrs

Differential Revision: D1102269
Fix a bug in preOptimizeStLoc

With the control-flow sensitive local type inference in
hhbbc, a local was being asserted as Type::Null.  Because
isKnownDataType returned true, preOptimizeStLoc decided that
converting that local from KindOfUninit (the actual live type) to
KindOfNull did not require storing a new m_type value, leading to a
crash down the line in the next translation.  I tried cleaning up
isKnownDataType but too many things depend on it (also it's a little
conceptually shaky because of how we deal with Str), so for now tasked
and just fixed this function.

Reviewed By: @swtaarrs

Differential Revision: D1099460
Update the types of locals when conditionally branching on their types

This makes some of the common patterns of user-level explicit
type tests update the types of locals on each side of the conditional
branch.

I thought a bit about how to do this without just pattern matching on
common bytecode pairs, but this seems the simplest way to get what we
want for now.  One other idea basically would involve a whole pass to
figure out which stack slots have the same types as which locals
(taking into account things that kill that relationship), which seemed
like it was unlikely to get any more types (although it would be "more
general").

Still a TODO is instanceof + jmp.

Reviewed By: @edwinsmith

Differential Revision: D1093057
Fix some reflection under hhbbc, and for HNI functions after "refactor func.h"

The hhbbc case was a bug---for HNI it is a change in behavior
that looks unintentional, but I sorta doubt anything relies on the old
behavior.  Also remove the StringData* overload so you can't
accidentally call the wrong function, and add documentation.

Reviewed By: @alokmenghrajani

Differential Revision: D1099590
Several type system bug fixes, and improve inference on jmpType for IsTypeL

Several of the functions relating to option types were wrong
if the option type had data (e.g. types like ?SStr="foo").  It's
easier to get everything right after adding TOptC{Str,Arr} types,
although I don't think they should happen much, so I added those.
Also, update IsTypeL; Jmp cases to do as good as the CGetL; Jmp cases
do with optional object subtypes.

Reviewed By: @edwinsmith

Differential Revision: D1099593
Revert "make filter_var snapshot the variables at request start"

This reverts commit de0579e00c94928357588ceb2796294be9110178. It broke
test/quick/debugger/flow.php

Reviewed By: @ptarjan
Disable flaky zend test

Reviewed By: @jdelong

Differential Revision: D1103516
Reduce hhprof crashes

- Memory profiling should not result in allocations and VM re-entry if we're crashing
- Fix call fixup in function prologue

Reviewed By: @jdelong

Differential Revision: D1102730
Don't warn for system functions that aren't known at static analysis time

The c++ implementation of array_filter was recently removed,
and static analysis doesn't see .hhas files, so is now unaware of the
function, and so spits out UnknownFunction warnings. In addition, until
D1099615 lands, functions defined in mini-systemlibs aren't known either,
and so result in similar warnings.

This is a quick hack to eliminate those, so we can hotfix it to rc. I'll
do a better diff on master on top of D1099615.

Reviewed By: @ptarjan

Differential Revision: D1103230
Include template functions in perf-pid.map

Template symbols are tagged WEAK, and neither
LOCAL nor GLOBAL. We need to include those in perf-pid.map
though.

Reviewed By: @ottoni

Differential Revision: D1103103
Implement replace{C,TV} on VM stack

These are just wrappers for the behavior of pop{C,TV}() and pushFoo(),
but without the inc/dec.

Reviewed By: @jano

Differential Revision: D1100964
fix to allow proc_open() to accept php://stdin as stdin

I added some code to the openFile function in runtime/ext/ext_process.cpp that accounts for the case when the user calls proc_open() using
php://stdin as stdin for the process spawned.

Reviewed By: @ptarjan

Differential Revision: D1094713
Rename EvalHHIRAllocXMMRegs to EvalHHIRAllocSIMDRegs

Now the option name isn't arch-specific.

Reviewed By: @bertmaher

Differential Revision: D1104420
Close pdo connection after request ends

When a request finishes and the PDO connection is not closed in
userland, we need to explictly close it to prevent excessive amount of
connections (and eventually causing MySQL to reject them).

This can obviously be solved in userland by closing the connection in a
register_shutdown_function, but we need to be consistent with PHP.

Closes #1345

Reviewed By: @markw65

Differential Revision: D1098327

Pulled By: @scannell
Only save SessionRequestData's default module once

It was getting overrwritten every time session_set_save_handler() was
being called.

Also ext_session_request_shutdown() was calling close() on the session
module twice, fix that.

Reviewed By: @ptarjan

Differential Revision: D1101153