Refactor NativeFuncCaller

Summary: Get rid of the class, and add an int-only specialization.

This is only a minor perf win (~ +0.2%)
but it sets the stage for D1505459 to
not be a horrendous regression (~ -1.0%)
but rather wind up roughly perf-neutral.

Reviewed By: @elgenie

Differential Revision: D1512802
Enable variadics for HNI functions/methods

Summary: Declare a function using the usual variadic syntax with no type

  <<__Native>>
  function foo(int $a, float $b, ...$c): void;

Then take the variadics args as a const Array&:

  void HHVM_FUNCTION(foo, int64_t a, double b, const Array& c) {...}

Profit.

Note that this version does not include FCallBuiltin support,
but since the old IDL version of variadic functions didn't either,
that's not going to make anything any worse.

I think I can add FCallBuiltin support later, but I'd rather
make that a separate diff.

Reviewed By: @elgenie

Differential Revision: D1505459
Convert v?s?printf() to HNI using Variadics

Summary: This helps test D1505459 by actually
exercising the variadic support in Native::callFunc()

Reviewed By: @elgenie

Differential Revision: D1512815
Make DataType covariant

Summary: We want to beable to have `MyThingDataType::at()->impl()` be typed as `MyThingDataType` while having `MyThingDataType::at()` typed as `DataType<Tk, Tv>`.
The solution is to pass `this` out of `::at` so that the return type is `DataType<Tk, Tv, this>`. This allows `impl()` to return the base class. In order to do this I need `DataType` and `DataTypeImplProvider` to be covariant. This diff hacks hack to think they are until we have a better solution.

Reviewed By: @jwatzman

Differential Revision: D1515044
Error numbers

Summary: This diff associates a unique integer with each error.
The error message now includes that error number and the error kind.
There are 4 kinds of errors: Parsing, Naming, NastCheck or Typing.

One can guess the error kind from the error code:
1000 < Parsing errors
2000 < Naming errors
3000 < NastCheck errors
4000 < Typing errors

Reviewed By: @elgenie

Differential Revision: D1514275
Custom path to the installed folder

Summary: Makes it possible selection of configuration folder hhvm, the default folder configuration nailed to the `/etc/hhvm/` but it's only for Linux justified.

ref: facebook/hhvm#3197
Closes https://github.com/facebook/hhvm/pull/3517

Reviewed By: @ptarjan

Differential Revision: D1505433
Add --git-mv,-g option to move_good_tests

Summary: This could ease move good tests, when there are many tests
passed, git don't know that, or I have to do extra work to
commit them
Closes https://github.com/facebook/hhvm/pull/3464

Reviewed By: @ptarjan

Differential Revision: D1502241
Implement APCIterator

Summary: Implement a basic version of APCIterator
I tried to match most of php, but
it does not match php5 completely due to for example not implemented functions.
Inheriting from this class most likely won't exactly match php due to valid() calls in some methods etc.

However this is an implementation that passes all (but one) zend tests and thus matches general php behaviour
It works in all basic usages.

I use apc_cache_info() as the interface between C++ implementation and PHP
That function spits out all the information that our APC implementation has implemented

Currently unsupported is:

 * most of the format flags due to them not being implemented at all in C++
 * * working flags are: type, key, value, mem_size, ttl
 * chunk_size does nothing, because I don't save the data in my class
 * list because not implemented in C++ (I believe)
 * filehits cache not implemented in C++

Closes #406
Closes https://github.com/facebook/hhvm/pull/3443

Reviewed By: @ptarjan

Differential Revision: D1492232
Only emit specialized PackedArrayGet when array may be packed

Summary: Also, make the IR correct by inserting an AssertType after the dynamic check.

Reviewed By: @bertmaher

Differential Revision: D1513530
Fix CVE-2014-3597 Possible segfault in DNS response overrun

Summary: Validate dlen at every turn. Leave no overrun unchecked.

Ref: https://bugs.php.net/bug.php?id=67717

Reviewed By: @ptarjan

Differential Revision: D1512572
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