Add a thread filter to the ring buffer

Summary: Typically you just want to know what was happening recently on
the thread that crashed, so add a thread parameter. 0 means all threads.

Reviewed By: @swtaarrs

Differential Revision: D1634720
emitFuncGuard should use prepareForSmash

Summary: We don't want to recreate the alignment logic
in lots of places, and we need to tag the guard so that
future relocations know its alignment requirements

Reviewed By: @swtaarrs

Differential Revision: D1634806
Add ReflectionClass::getAttribute to HHI

Summary: Already there for functions and parameters, was missing for classes. Fixes facebook/hhvm#4049

Reviewed By: @jano

Differential Revision: D1634952
Micro-optimize InitPackedArrayLoop

Summary: Its okay to use SIMD registers to move values from the stack to
the array, because PackedArray doesn't use TypedValueAux's m_aux
field. Use the flags from subqi instead of cmp(0,j).

Once those changes were done I noticed an xchg crept into the
code (due to lack of phi-hinting), so fiddled the initialization
order to suppress the xchg.

Reviewed By: @mhahnenberg

Differential Revision: D1632139
LZ4_uncompress is obsolete, breaks build with out-of-tree LZ4.

Summary: LZ4_uncompress() has been replaced 1:1 with LZ4_decompress_fast().  When
you use an out-of-tree liblz4 r122 or beyond, LZ4_uncompress doesn't exist
anymore.  From bottom of lz4.h:

 [...]
 /*
 Obsolete decompression functions
 These function names are deprecated and should no longer be used.
 They are only provided here for compatibility with older user programs.
 - LZ4_uncompress is the same as LZ4_decompress_fast
 - LZ4_uncompress_unknownOutputSize is the same as LZ4_decompress_safe
 */
 int LZ4_uncompress (const char* source, char* dest, int outputSize);
 [...]

LZ4_decompress_fast() is already present in third-party's copy, so even if this
is not breaking a build with an internal lz4, it is for Debian and any other that
may have the library outside of the HHVM tree detected by CMake.

Closes: https://github.com/facebook/hhvm/issues/3610

Reviewed By: @ptarjan

Differential Revision: D1628566
Add operator|(PhysReg) and a few other overloads, and use them.

Summary: Makes RegSet manipulation a bit clearer.

Reviewed By: @swtaarrs

Differential Revision: D1636964
Fix findPrecedingFPI

Summary: Its possible that the first fpi region contains the
region we're after. Initialize fe to nullptr, and start from 0.

Reviewed By: @jdelong

Differential Revision: D1636070
Make uniqueStubs for bindCall

Summary: Most of the information compiled into the bindCall stubs can be computed from the callee ActRec. Once thats done, we only have two stubs; one for immutable calls, and one for non-immutable calls. So make a uniqueStub for each.

Reviewed By: @edwinsmith

Differential Revision: D1633348
Allow unlimited memory for the warmup requests

Summary: I guess it wasn't as bad as I thought.

Reviewed By: @bertmaher

Differential Revision: D1636748
Initial foundation for merging CodeGenerator classes

Summary: This is a real idea, but if people hate it I can pursue something else.

The plan is to gradually convert as many opcodes as possible in the ARM
class to DELEGATE_OPCODE first, before eventually merging the classes.
This will make the eventual merge go as smoothly as possible. Here's how
I envision it:

- Turn as many opcodes as possible into DELEGATE_OPCODE on the ARM side,
  both ones that are currently punting and ones that have real
  implementations. This will probably entail adding an x64->arm lowering
  pass to allow to use more of the x64 implementations unmodified.

- When that's done, merge the classes. Everything will go through
  x64::CodeGenerator. For the opcodes that still have divergent ARM
  implementations, we'll create things like cgBlahX64 and cgBlahARM,
  mechanically

- For those divergent opcodes, we can gradually replace them with mostly
  merged versions, with a little bit of branching in the middle.

Reviewed By: @edwinsmith, @swtaarrs

Differential Revision: D1635576
Make sure type is right when emitting testbi.

Summary: If the argument to testbi is larger than 1 byte we need to truncate it.

Reviewed By: @markw65

Differential Revision: D1636186
Fix logging

Summary: We were clearing some of the stats before logging them

Reviewed By: @jano

Differential Revision: D1637551
Remove tc-space reporting of astubs

Summary: Astubs hasn't existed for almost 6 months now, so it's about time to
retire this stat.  We can always synthesize it in ODS if needed.

Reviewed By: @ottoni

Differential Revision: D1631327
Use operator= instead of clear to reset MM.m_instances

Summary: clear() doesn't guarantee to release the underlying storage of the
map, whereas operator= with a new empty map should.
Only do this if m_trackingInstances, to avoid construction unless needed.

Reviewed By: @shai-d

Differential Revision: D1631356
Use operator= instead of clear to reset xmlErrorVec

Summary: clear() doesn't free storage, so this could grow steadily over time.

Reviewed By: @edwinsmith

Differential Revision: D1632303
backport PHP bugfix #43540

Summary: We need to properly set newlength.

See:
- https://github.com/php/php-src/commit/898ff10dc0f799ecf997cb3c64a96f2751884187
- https://bugs.php.net/bug.php?id=43540
Closes https://github.com/facebook/hhvm/pull/4014

Reviewed By: @ptarjan

Differential Revision: D1626102

Pulled By: @fredemmott
Fix incorrect LOCK_UN for user-land stream wrappers

Summary: We were passing native LOCK_UN value, but PHP's value differs.
These should be probably switched to k_* once constants idl is ported.

Closes #3887.
Closes https://github.com/facebook/hhvm/pull/4034

Reviewed By: @fredemmott

Differential Revision: D1630986