add OPT_VERIFY_KEY, OPT_SORT_HOSTS, resetServerList()

Summary: Fixes #3615, #3616, #3617. A superset of #3827.

Thanks to@​keyurdg and@​adsr for helping me out!
Closes https://github.com/facebook/hhvm/pull/3833

Reviewed By: @ptarjan

Differential Revision: D1576206
Implement getImageSizeFromString()

Summary: Open a data stream to get the string as a stream which can be passed to the logic in f_getimagesize(). This logic is moved into a new function

The implementation of getImageSize() and getImageSizeFromString() could be moved to PHP, but I am not sure how to expose the C++ function to PHP land.

Fixes #3801

Closes https://github.com/facebook/hhvm/pull/3838

Reviewed By: @ptarjan

Differential Revision: D1576163
Expand assert in LightProcess::proc_open

Summary: This is occasionally firing in prod. There haven't been any useful
core files but this might give us a hint as to what's going wrong.

Reviewed By: @ptarjan

Differential Revision: D1577087
Tweak the test script.

Summary: Separate the diff-generation from the actual testing.

The review script makes iterating more convenient.

Reviewed By: @jwatzman

Differential Revision: D1568601
Check exprs with short-circuit operators correctly

Reviewed By: @jwatzman, @elgenie

Differential Revision: D1567624
Maybe a refcount leak

Summary: While testing objprof I noticed that interp mode gives me the right refcount while jit mode doesn't.
Specifically, for string keys of array-data, they have one too many refcounts.
I tried to triage this with debug prints and I reached addElemStringKeyHelper (an op references from hhbc).
It looks half "copied-pasted" from the addElemIntKeyHelper except it doesn't dec the key's ref count.

I added key->decRefCount() and tested that home.php still works on my sandbox and that it fixed the refcount issue for me.
Now I'm diffing this and also running a perflab.

Image- https://www.latest.facebook.com/pxlcld/lDgL

Reviewed By: @markw65

Differential Revision: D1573712
mark test flakey

Summary: I saw it fail returning a newline on the read

Reviewed By: @paulbiss

Differential Revision: D1577555
EZC: clear EG(exception) on return from zend_wrap_func()

Summary: Otherwise, if the exception is caught and then control is returned into
a zend_call_function() call which wrapped the throwing function, then
zend_call_function() will erroneously rethrow the exception, even though
it has already been handled.

https://bugzilla.wikimedia.org/show_bug.cgi?id=71174
Closes https://github.com/facebook/hhvm/pull/3834

Reviewed By: @ptarjan

Differential Revision: D1574411
Punt in ARM codegen for CallBuiltin if it needs stack args

Summary: They're not yet supported. I put the punt here rather than in
cgCallHelper itself because cgCallHelper is sometimes called in places that
can't handle punting.

Reviewed By: @edwinsmith

Differential Revision: D1577753
Refactor the parsing and processing of config options

Summary: The rise from the ashes edition....

D1554807 reverted the refactoring that I did to prepare for the hdf move to ini conversion because, well, I had missed a couple of things and started to break stuff.

Here we go, trying this again. I think we are at equivalent functionality as before this diff, modulo some bug fixes that should be useful and good.

Here is the lowdown:

1. Refactor so we have one goto place for parsing, processing and binding of config options.
2. Fixed a bug where some `-v` overrides were not being respected when the same option was being given in a `.ini` file.
3. Fixed a bug in `IniSetting::Set` where updates were not happening to existing pairs. That was actually a subtle, but big find.
4. Got a little more clever on how we re-parsed ini files for extension constants. Before we were parsing the whole file again, un-overriding any overrides that were given at the command line. Now we just deal with unbounded extension constants.
5. Precendence order for config options should be right. `ini file -> hdf file -> ini cli settings -> hdf cli settings -> Tiers -> ini cli settings re-check -> hdf cli settings re-check -> Load and Bind`
6. Reflect reality when it comes to the actual value of a `RuntimeOption` compared to the value exposed to a call to `ini_get()` for that `RuntimeOption`.
7. In the short term, during the migration, hdf always wins over ini.

Reviewed By: @markw65

Differential Revision: D1555790
Change Vreg to use PhysReg numbering, hoist vasm out of x64::

Reviewed By: @jasone

Differential Revision: D1577736
Turn on refcount-opts with loops.

Summary: D1550496 seemed to be the last of the issues.

Reviewed By: @ottoni

Differential Revision: D1577195
Move genCodeImpl from code-gen.cpp to back-end-arm.cpp

Summary: It is only used for ARM, and I need to customize it even
more to get ready for arm using vasm.

Reviewed By: @jasone

Differential Revision: D1577792
Decouple llvm from vasm::finish

Summary: This uncouples the vasm->x64 final code generation passes from
LLVM generation, which is a necessary step so we can generate
target-specific vasm in CodeGenerator, in cases where its more
convenient than being forced to have a target-specific lowering
pass.

ARM changes will add a finishARM() function and may require more
refactoring, for example we could factor out the target-agnostic
vasm optimizations, like vasm-dead and vasm-jumps.

Reviewed By: @jasone

Differential Revision: D1577810
Support custom stream wrappers in XMLReader::open()

Summary: This is similar to the treatment that was applied to a few other places in
842d6fb7dcd6d: manually create an IO object and use that to create the
xmlTextReader, rather than just calling xmlReaderForFile. This fixes web
importing of pages in MediaWiki.

Closes https://github.com/facebook/hhvm/pull/3840

Reviewed By: @ptarjan

Differential Revision: D1576426

Pulled By: @swtaarrs
Skip translation of region blocks that turn out to be unreachable

Summary: Region formers may create regions that contain blocks that the IR can
later prove they won't be reached. When this happens, the region
translator will try to call IRBuilder::startBlock() on a block for
which no FrameState is saved.  This isn't supported: IRBuilder assumes
that, before emitting code to a block, at least one of the
predecessors has been finished.  This diff changes the region
translator to skip blocks that turn out to be unreachable, and it
strengthens the region checker to check both the assumption above and
that a region is in topological order unless loops are enabled.

Reviewed By: @alexmalyshev

Differential Revision: D1578127
Remove control flow related code

Summary: Its been dead since I turned off Option::ControlFlow

Reviewed By: @jdelong

Differential Revision: D1578124
jit/containers.h shouldn't pull in smart-containers.h

Summary: We're using std containers right now, so there's no reason to pull in
the smart ones.

Reviewed By: @edwinsmith

Differential Revision: D1579289
Move GuardConstraints to its own header

Summary: There's no reason for everyone to include it via ir.h

Reviewed By: @ottoni

Differential Revision: D1579426
Move StackValueInfo methods to simplifier.cpp

Summary: This lets us forward declare SSATmp and IRInstruction in simplifier.h
Since simplifier.cpp is the only user of StackValueInfo methods this
shouldn't change perf.

Reviewed By: @edwinsmith

Differential Revision: D1579548