Put bytecode control flow on a build flag

Summary: We want to be able to test these via build flags.

Reviewed By: @ottoni

Differential Revision: D1514992
Don't shrink String arguments to trim() in place

Summary: The jit expects to decref the arguments to trim() after the call, and
expects to be able to keep the pointers to the args in callee-save registers
across the call.  This assumption causes a problem in the test case, in which
an argument with a single reference is shrunk in-place during trim.  The shrink
allocates a new, smaller buffer, and frees the old one (because it has a refcount
of 1).  The jit isn't aware of this, and also tries to decref and free the
argument.

This diff fixes the problem by always wrapping the possibly-shrunken StringData
to be returned in a new String.

Reviewed By: @markw65

Differential Revision: D1515837
hphp: avoid potential buffer read-overrun

Summary: * hphp/runtime/ext_zend_compat/php-src/main/network.cpp:
When the source string has length >= bufsize, php_socket_strerror (with
a non-NULL buffer) would fail to NUL-terminate the result buffer. Write
an explicit NUL byte to ensure that.  Currently, no caller of this
function exercises the affected code paths, because the "buf"
parameter is always NULL.

Reviewed By: @ptarjan

Differential Revision: D1463545
Fix int32 overflow in TimeZone::offset()

Summary: There is an integer overflow which is causing garbage to be returned from TimeZone::offset()

Reviewed By: @scannell, @jasone

Differential Revision: D1514780
Delete unused stat counters

Summary: All of these are unused. I suspect some of them were originally meant to
count something that we still care about (e.g. tracelet guard
executions?) but the callsites have bitrotted away.

I think we'll need automated testing if we care about a particular stat
enough to keep it. I'd like to check this diff in as-is, but it's also
partially a forcing function to get people to reinstate stat counters
that they actually care about.

Reviewed By: @edwinsmith

Differential Revision: D1515024
Get one std::vector ini bound

Summary: Let's get one collection-based ini setting bound. Choosing a `std::vector<std::string>`
based setting, `AllowedExecCmds`. If this works, then other `std::vector<std::string>`
settings should follow suit nicely.

Reviewed By: @ptarjan

Differential Revision: D1510936
Fix stack corruption in ezc_set_error_reporting() in ezc_test.cpp

Summary: Found a stack corruption bug while testing with ASAN. Fixed it.

Reviewed By: @markw65

Differential Revision: D1516723
Fix inner class specialization on Box

Summary: Drop inner class specialization on Box if the class
does not have AttrNoOverride.

Reviewed By: @alexmalyshev

Differential Revision: D1507916
Support for variance (+/-) annotations on type-parameters

Summary: We want to be able to write:
class X<+T1, -T2> {}
To be able to tell the type-checker that T1 is covariant and T2 is contravariant.
The annotation is ignored (dropped) by the runtime.

Reviewed By: @elgenie, @paroski

Differential Revision: D1512765
Add a ResourceExceededException parent for timeout and OOM

Summary: Makes it easier to catch them together.

Reviewed By: @markw65

Differential Revision: D1514062
Don't swallow timeouts and OOMs from userland callbacks

Summary: Namely, __toString() in exceptions and exception_handler() callbacks
called from exception-delaying contexts.

Reviewed By: @markw65

Differential Revision: D1505603
Don't swallow ResourceExceededExceptions if {,un}serialization fails

Summary: This is probably a good idea.

Reviewed By: @markw65

Differential Revision: D1509475
Check surprise flags when unserializing arrays and objects

Summary: The allocation of a single unserialize can potentially be massive, so
let's throw an OOM before we allocate the whole thing instead of after.

Reviewed By: @markw65

Differential Revision: D1511806
cleanup unneeded ini binding

Summary: Remove more duplicated and unneeded ini bindings.

Reviewed By: @ptarjan

Differential Revision: D1331547
Use std, boost, and folly instead of smart containers.

Summary: Using the smart-allocator based containers has a marginal
speed win (5-7% faster jit time than jemalloc), but consumes
memory that contributes to the current request's allocation budget,
which isn't fair.

It's probably better to optimize allocation in the JIT by using Arena,
small_vector, vector::reserve(), etc.

Reviewed By: @ottoni

Differential Revision: D1147885
Use memcpy instead of mempcpy

Summary: Non-GNU platforms don't support mempcpy. As the return value isn't being used
here, memcpy can safely be used instead.
Closes https://github.com/facebook/hhvm/pull/3572

Reviewed By: @sgolemon

Differential Revision: D1517085
Fix casting to wrong type.

Summary: hhvm/hphp/runtime/ext/gd/libgd/gd_webp.cpp:75:10: error: cast from pointer to smaller type 'unsigned int' loses information
                temp = (unsigned uint8*) gdRealloc(filedata, size+GD_WEBP_ALLOC_STEP);
                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Closes https://github.com/facebook/hhvm/pull/3573

Reviewed By: @sgolemon

Differential Revision: D1517087
Use pkg-config to find libmemcached

Summary: libmemcached-0.28 requires linking with an additional library (-lmemcachedutil).  Simplify the cmake code and pick up that additional dependency at the same time by using pkg-config.
Closes https://github.com/facebook/hhvm/pull/3591

Reviewed By: @sgolemon

Differential Revision: D1517441
Rename some things from unserialization-OOM commit

Summary: Names are nice.

Reviewed By: @jasone

Differential Revision: D1517664
Convert more print statements in the gdb .py files to run under python 3...

Summary: ....

This follows:
  https://github.com/facebook/hhvm/commit/fa214a8f475a66ab66fa2778af4019e7a298499c
This addresses issue:
  https://github.com/facebook/hhvm/issues/3448
Closes https://github.com/facebook/hhvm/pull/3569

Reviewed By: @ptarjan

Differential Revision: D1517079

Pulled By: @sgolemon