ArrayIterator casted to array should result to the storage array

ArrayIterator was not correctly casted to array. This diff corrects the issue by overriding the array conversion method.

Fixes #2214

Reviewed By: @ptarjan

Differential Revision: D1270947
hhi sync

Updates from www

Reviewed By: @elgenie
Improve behavior when serializing unserializable builtin classes

Instead of serializing an object of some unrelated type,
serialize a null.  The old way had a dynamic property telling you
which type you messed up with, but this is not nearly as useful as a
stacktrace at serialize time, as the code doing the serialization is
generally going to be the code making the error.  "Null" is also going
to make this easier to deal with for private property inference---if
we've determined that a private property has any object type,
currently either it is going to be nullable or one of the collection
types (which are known to be serializable).  Presumably the old dummy
continuation method was also easier for private property inference
because dummy continuations derived from Continuation?

Reviewed By: @jano

Differential Revision: D1274152
Remove a default on an arch() switch

Noticed while grepping not_implemented() sites.

Reviewed By: @jasone

Differential Revision: D1274907
Small fixes so hhbbc doesn't assert-fail some cases with malformed classes

I realized I was assuming there must be at least one
ClassInfo for the context class here, but that's not true if the class
is malformed enough that we decided it would always fatal to define
it.  This also means another always_assert about unique classes was
too strong (but earlier it was useful for debugging), so remove that.

Reviewed By: @jano

Differential Revision: D1274285
Allow NativeFuncCaller to handle up to 32 args regardless of type

Since we're hard-coding knowledge of the ABI into the JIT
anyway, might as well teach interp mode how to take advantage of it.

The AMD64/ARMv8 ABIs don't actually care about the specific order
of INT/SSE args with relation to one another up to the stack frontier.

Take advantage of this by reordering the first 8 double args to the start
of the function call and autoboxing all remaining doubles to ints so that
we only have to create fcall typedefs for arbitrary numbers of INT args.

For functions which take more than 8 doubles, but fewer than 6(or 8 on ARM)
INT args, we pad GPargs with nulls to land the extra SSEs on the stack.

This drops our complexity from O(2^N) to O(M*N)
M == Number of SIMD registers (8 for both amd64 and ARMv8)
N == Maximum number of args, type irrelevant (arbitrarily set to 32)

Build time (on my box) for native.cpp has dropped to ~15s

There are no longer any templates (recursive or otherwise) left in native.cpp

I expect this to be a slight perf regression for interp mode,
since we're pushing args into intermediate vectors,
but since basically every global function is now FCallBuiltin
capable, it shouldn't effect those in JIT mode.

JIT calls to HNI object methods may see a perf hit, but that's
something I'll be able to win back by making them eligible
for FCallBuiltin in a followup diff.

Reviewed By: @edwinsmith

Differential Revision: D1263316
Fixed a few spelling mistakes

Closes #2447

Reviewed By: @gabelevi

Differential Revision: D1274822

Pulled By: @jwatzman
Fix bugs in instrJumpOffset, make check_func.cpp more friendly to new argtypes

instrJumpOffset was using unmangled arg type names, so it
would use the enum values and continue to compile if you forgot to add
a new define.  Also remove a default so check_func.cpp fails to
compile with new arg types, instead of failing assertions at runtime.

Reviewed By: @edwinsmith

Differential Revision: D1274392
Add some data annotation to allow for data profiling

perf on kernel 3.10 can record data addresses. This diff
adds an option to write a perf-data-<pid>.map analogous to
perf-<pid>.map to allow us to interpret the results.

Reviewed By: @bertmaher

Differential Revision: D1272287
Add hacky destructor to UConverter to prevent infinite recursion

IntlUConverter is the native data for UConverter, and ~IntlUConverter
runs user callbacks that ultimately access the UConverter ObjectData,
which will rerun ~ObjectData and we go into a cycle. Run the callbacks
in UConverter::__destruct instead.

Breaks compat with PHP5, as UConverter is not supposed to have a
destructor defined. Not intended to be permanent.

The real fix is to have a better story with how native data objects are
destroyed. Mandating that they always get destroyed after their
associated ObjectData isn't going to work if we want to fully match PHP5.

Reviewed By: @ptarjan

Differential Revision: D1273255
Make getStaticVariables() and getClosure() more compatible with PHP5.

`getStaticVariables()` used to return array(name => php_code), now it
returns the actual variable values, which is what PHP5 does.
One difference is that PHP5 returns the correct defaults from the start,
we return NULLs until the function is called at least once. Making that
work seems to require a very non-trivial fix.

`getClosure()` behavior now matches PHP5. It always returns a Closure
instance.

Also removing that buggy j0nx with double initialization in `ReflectionFunction::getMethod`.
When `ReflectionClass::getMethods()` was called before `getMethod()`, `hphp_get_method_info` was never called.
The values that were set in `getMethod()` are identical to what the `ReflectionMethod` constructor sets anyway.

Reviewed By: @ptarjan

Differential Revision: D1255330
Prefix native systemlibs with /:systemlib

Now that they are in the repo, using the empty string can
cause problems: attempts to access illegal paths will try to load
these because File::TranslatePathKeepRelative returns "" for a
failure.

Reviewed By: @bertmaher

Differential Revision: D1275493
Fix order of key/val setting for IterNext helpers

The correct ordering is to set the value first, then the key. (if it
exists) After combing runtime/base/array-iterator.cpp, I found a few
instances where we had this flipped.

Reviewed By: @jdelong

Differential Revision: D1275430
Test runner shouldn't display progress bar unless stty supports erase

I usually run my shell from inside emacs and the uber-leet
progress bar is too cool for the emacs terminal (it doesn't understand
"return to beginning of line").

Reviewed By: @alexmalyshev

Differential Revision: D1276186
Support multiple parallel configs in server mode tests

test/run will now start up one server for each config required for the
specified tests. This allows us to run things like "test/run -s quick slow"
instead of breaking it up into two different invocations.

Reviewed By: @jdelong

Differential Revision: D1274473
Fix debug target in Makefile

Does anybody even use this? I have no idea how
it ever worked in the first place without sticking
-I in front of the include dir names.

Reviewed By: @jwatzman

Differential Revision: D1274662
Fix crash when trying to change staticness of a property

If we found that a property had been redeclared as static
after originally being declared non-static, we hunted through the
parent preClasses to find the original definition. But the original
definition might have been in a trait. Also, the prop itself knows
where it was originally defined, so just use that.

Reviewed By: @ottoni

Differential Revision: D1275832
Yell when returning anything from a void function

Even `Tany`, which we admitted before even though it was
clearly bogus (see `void_return2.php`).

This requires considerable www cleanup, diff TBD.

Reviewed By: @elgenie

Differential Revision: D1141436
Translator isn't a base class; replace raw pointer member

Replace a ProfData* member of Translator with a std::unique_ptr and
delete the virtual destructor (it has no derived classes anymore).

Reviewed By: @ottoni

Differential Revision: D1273136
Don't use hack features in a non-hack file

Even though trailing commas are the BEST FEATURE EVER,
we have to leave them out of test/run since it's an intentionally
non-hack file.

Differential Revision: D1277631