Pass InliningDecider by reference in tracelet selector

Summary: We disable inlining and try again if the tracelet gets broken while
still inlining, but the InliningDecider was copied into RegionFormer. We need
to store a reference instead, so the change persists across calls to
RegionFormer::go().

Reviewed By: @mxw

Differential Revision: D1469299
Clean up handling of Obj types

Summary: - Type::operator& wasn't properly combining exact and sub Obj types
- NewInstanceRaw now returns an exact Obj type
- CustomInstanceInit doesn't take a Cls src so being DAllocObj was nonsense
- optimizedCallGetClass was doing different things depending on the opcode the
  object came from, and this was causing behavioral differences between
  inlining analysis and translation. I changed it to do something more generic
  that should be faster anyway, which allows restoring of an assert in
  selectTracelet. It can't be an always_assert like it used to until the
  remaining issues in prod are sorted out.

Reviewed By: @alexmalyshev

Differential Revision: D1469306
Use size_t for string length parameters which are checked against MaxSize

Summary: A common pattern is to reserve space with the ReserveString mode of the
String constructor and then to put data directly into the string buffer
with memcpy() etc. The reserve length was an int, which led to
truncation and exploitable integer overflow for many callers. Added four
test cases demonstrating exploitable heap overflows due to the use of
ReserveString.

There is generally very little performance benefit to using a smaller
type in an argument, since 64-bit alignment is used when passing
parameters on the stack, and 64-bit registers are reserved when passing
in registers. This is in contrast to object storage where there is a
clear rationale for the use of 32-bit types.

So:
* Use size_t for length in all variants of StringData::Make().
* In the version of StringData::Make() which takes a null-terminated
  string with implicit length, do not truncate the return value of
  strlen().
* Use size_t for length in reserve(), shrink() and escalate(), since
  these call the modified StringData::Make() and so can benefit from
  64-bit size checking.
* StringData::setSize() is the one exception; it still uses int, on the
  basis that it is non-throwing, and making it throw would probably mean
  making it  non-inline. In the four test cases, StringData::setSize()
  is called with a smaller size than the one used for the preceding
  StringData::Make(), so it is safe in those cases.

Also:
* Fix a bug in allocFlatForLen() where the length could overflow before
  it was checked against MaxSize. If len is approx. UINT_MAX-2, then
  uint32_t(sizeof(StringData)+len+1) would be a small integer less than
  StringData::MaxSize.
* Fix integer truncation in f_utf8_encode(). If the input string is
  slightly larger than 1GB, data.size()*4 would be a small positive
  integer. Casting to size_t allows the error to be trapped by
  StringData::Make().

Reviewed By: @edwinsmith

Differential Revision: D1431966
Fix heap overflow in sql_regcase() for input >1GB

Summary: Rewrote it using StringBuffer, since that seems to be the standard
way.

Reviewed By: @bertmaher

Differential Revision: D1434342
don't emit all the skipped tests for fbmake

Summary: This breaks phabricator having 5k skipped things clogging up our results.

Reviewed By: @bertmaher

Differential Revision: D1472058
fixed an error in the hphpize.cmake file

Summary: LIBDIR was repeated twice. The first one should have been PREFIX

Reviewed By: @ptarjan

Differential Revision: D1471149
gperftools include file don't find

Summary: google/profiler.h don't find

Closes https://github.com/facebook/hhvm/pull/3325

Reviewed By: @ptarjan

Differential Revision: D1470627

Pulled By: svcscm
Add LibGMP extension

Summary: I've recreated the PHP gmp extension with HNI.  I believe it to be working well, but this is the first extension I've written so any and all criticism of my C-code is encouraged.

This extensions supports all GMP functions, and constants, with the exception of gmp_random.

I have submitted a CLA in the past; it might be under "ian@ my github username" (CA -> .ca); I had to submit it a few times last time around, so hopefully it's properly on record this time; if it's not, let me know.

Cheers

Closes https://github.com/facebook/hhvm/pull/3314

Reviewed By: @ptarjan

Differential Revision: D1470423

Pulled By: @sgolemon
Print current approx typechecking position on SIGUSR1

Summary: When some code being typechecked causes pathological behavior
in the typechecker, it can be useful to figure out approximately where
in the codebase we are checking. Right now, this involves a lot of
one-off logging being manually added, so let's do something a little
more clever. Every time we typecheck an expression, record its position,
and then on SIGUSR1, print that out. The envisoned use case is to attach
to a runaway proccess with gdb, look at the backtrace, and kill it with
SIGUSR1 to try and figure out WTF is going on.

We may ultimately want to expand this into something more general,
notably including things other than typing, but this is good enough for
now -- the 3-4 cases of runaway workers I've seen have all been in
typing.

This also kills `Typing.debug` since it was only used in one place, was
potentially confusing with the new data I'm adding, and was of dubious
utility (blocking `hh_show` in server mode).

Reviewed By: @elgenie

Differential Revision: D1467911
Fix usage of field_key/value in yield

Summary: This wasn't morally doing the right thing, even though the
current usages of `field_key` and `field_value` don't let you trigger
it. The type of an array field key and a `yield $x => $y` field key are
different mechanics, and the logic in the latter to determine whether a
missing `$x` is implicitly null or an int doesn't apply to arrays.

Reviewed By: @jano

Differential Revision: D1471174