Fix sockopen_impl with IPv6 addresses

sockopen_impl requires IPv6 addresses be enclosed in brackets.

Differential Revision: D927309
Add basic guard relaxation to hhir

This diff implements basic guard relaxation in hhir. Whenever we read
a local or pop/peek at HhbcTranslator's EvalStack, a DataTypeCategory is
specified. The source of the value is traced back as far as possible, and if we
end up at a guard instruction, the constraint for that guard is updated
appropriately. After IR generation, a pass is run to change the types of these
guard instructions to the least specific type allowed by their constraint. This
is currently only used to eliminate completely unused guards in the tracelet
region selector, so all the guards are either DataTypeGeneric or
DataTypeSpecific.

Differential Revision: D924955
move SplObserver tests from bad to good

move basic tests for SplObserver

Closes #968

Differential Revision: D935248
Fix a crash destroying Funcs

Func::destoy needs to block on getting the write lease, so it
can smash the function prolog.

Also, the prolog array in cloned closures is used to redispatch to
the translation corresponding to the clone, since we never enter
such functions via their prolog. Since its not a true prolog, we
shouldn't smash it.

Differential Revision: D933704
Trim down test/slow/ext_network

It's flaky because it depends on external servers
responding. Remove those bits.

Differential Revision: D935602
Fix some stack overflow bugs

If re-entry triggers stack overflow, there is no FCall or FCallArray,
so the code to find the pc in REQ_STACK_OVERFLOW would fail. If it
managed to get through there, it would then try to DecRef the contents
of an ActRec, sometimes causing it to DecRef a Func.

In addition, if a "leaf" function resulted in re-entry we didn't
necessarily check the stack.

Differential Revision: D936843
hphp: Instance ID for controlled stopping of server

When port-takeover is used, new instance of the process will be started but
something can call stop command for the old task. Given how `localhost:9099/stop?`
can affect hhvm that was just started, I want to limit stop command to be
specific to an instance ID.

This instance ID could be a random number, or container uuid of LXC.

Differential Revision: D932953
Remove allocElmFast; its only called in one place.

It used to have two callsites before the vector code landed.

Differential Revision: D932789
Do not check for self in assignValHelper.

It should be almost never true, and the assignment code is
already safe for self-assignment.  Note if Variant V == uninit,
then V=V now converts to null, unlike before.  IMHO this is
a bugfix but I don't know that we've seen it in the wild.

Differential Revision: D933229
Make new stack_overflow test more tolerant

In contbuild it's failing on line 5 instead of 6.

Differential Revision: D937472
Improve error message for post-try blocks which are not finally

Currently, hhvm interprets post-try blocks not necessarily
beginning with an actual finally token as finally blocks, and thus
produces an error message to the user telling them finally blocks
are disabled even if they misspelled something, for example.

This moves things so the "finally disabled" message only comes up
if you enter a syntactically valid finally block.

Differential Revision: D918867
Add DataTypeProfiler

You can use this anywhere to sample the DataTypes at a particular
point in the code, for example calls to JIT helpers.

Differential Revision: D925193
Prerequisites for eager execution of async functions

Here's a few minor changes in emitter that will be needed later for
eager execution of async functions. Just to make the upcoming diff
sipmler.

Differential Revision: D935301
Rename VectorTranslator to MInstrTranslator

Vector has become too overloaded in this codebase. MInstrTranslator is
more accurate anyway; we have multiple different types of hhbc opcodes with
immediate vectors that aren't m-instrs.

Differential Revision: D935859
Implement ReflectionParameter::IsCallable()

The Facebook SDK unit tests fataled because ReflectionParameter::IsCallable() was not implemented. So, this implements it. Now the unit tests pass. Bad zend test now passes!

closes #931

Differential Revision: D938769
Optimize string same() and hitStringKey()

Most strings used as keys are either small or not shared, where the
data pointers cannot be equal.  Of the rest (shared), most could have
been small.

This diff copies small SharedVariant strings, so they don't refer
back to the SharedVariant, and don't need to be enlisted.  Then,
this changes hitStringKey() to not check data pointers, making it
equivalent to StringData::same().  Lastly, hand-write the comparison
loop in StringData::same() so we compare words at a time, and the
loop can be inlined.

Differential Revision: D937233
Parser refactorings: onFunction/onMethod/onClosure

We have separate methods for parsing functions and methods
(onFunction/onMethod), which have a lot in common. On the other
hand, onClosure just calls onFunction with a special parameter
that modifies its behavior. Lets make this more consistent and
remove the duplicated code.

Differential Revision: D934034
Merge branch 'master' of https://github.com/facebook/hiphop-php