Fix Freetype to look for ft2build.h first

Summary: In the previous configuration, it would find freetype2 for me, but then fail to #include freetype.h through the macro header include.  In this configuration, it finds ft2build.h goes along happily.
Closes https://github.com/facebook/hhvm/pull/3532

Reviewed By: @ptarjan, @sgolemon

Differential Revision: D1508208
Move shape class constant typecheck from declaration to typing

Summary: The check needs to know about available classes and typedefs so
it can look into class constants and see what the typedef's underlying
type is. This means we needed to have completed declaration before doing
the shape class constant check. However, it was placed directly into
declaration itself, and so was sensitive to the order in which classes
were declared, which is nondeterministic. Instead, move it into typing,
when we know that everything has been declared and is available.

Reviewed By: @gabelevi

Differential Revision: D1512071
hash_equals raises a warning on wrong types

Summary: Also moved all good tests

Closes #3477
Closes https://github.com/facebook/hhvm/pull/3479

Reviewed By: @fredemmott

Differential Revision: D1500295
VASM part 6: generate vasm for the whole IRUnit

Summary: Finish converting all the remaining HHIR cg functions to vasm.
This required copying and specializing codeGenImpl(), so I added
that to the BackEnd api. The code duplication with ARM is unfortunate
but I expect it to be temporary; we'll be able to share a lot more
code again once ARM is converted.

Reviewed By: @alexmalyshev

Differential Revision: D1460418
VASM part 6 continued: remove useless control flow

Summary: Enable vasm classic control flow optimizations. The actual implementation
is in D1494657 just not used yet; see vasm-jumps.cpp. This diff starts using it.

 * if both targets of a jcc are the same, convert to jmp
 * if an edge goes to a jmp, use the jmp's target
 * if B1 ends with a jmp to B2 and B2 has 1 pred, merge B1 & B2
 * if B1 ends with a jump to an empty block with a jcc, copy the jcc.

Reviewed By: @alexmalyshev

Differential Revision: D1460505
Fix external build?

Summary: One external report that this unused variable was causing an
error in the build. Our internal build went fine, so this might be a
change in default warnings between 3.12 and 4.01? In any event, easy
enough to fix, and also remove warn-error in the external build for now.

Reviewed By: @gabelevi

Differential Revision: D1512305
Covariance fixes

Summary: This diff updates the typechecker to support covariance for the following
interfaces: Traversable, Container, Iterable, Iterator, ConstCollection,
KeyedTraversable, KeyedContainer, Indexish, KeyedIterable, KeyedIterator.

This diff also two bugs with covariance. First, it fixes the logic for
checking if array<..> is a subtype of Indexish<..>, Traversable<..>,
KeyedTraversable<..>, Container<..>, or KeyedContainer<..>. Second, it
fixes a bug in the covariance logic that was erroneously allowing certain
subtype relationships (for example, it was allowing a Pair to be passed to
a function expecting an ImmMap).

Reviewed By: @jwatzman

Differential Revision: D1511248
Make Set implement KeyedIterable and support bracket syntax for reading

Summary: Over time, Sets have slowly been moving towards supporting more key-based
operations (ex."array_diff_key(..)", "foreach ($set as $k => $v) {..}",
etc) to make collection adoption easier and to make things more convenient.
Likewise, Set->array was changed a while ago so that each value in the Set
is inserted into the array as both the key and value (to make interop
smoother between arrays and collections).

This diff takes another step in this direction by making Set to implement
KeyedIterable, by making Sets support bracket syntax for reading and
unsetting elements, and by making idx() work with Sets. This makes things
more consistent than the current state of affairs, and it also makes
migration easier by enabling things like "isset($set[$x])" to check if a
value is present in the Set. It also positions us better to eventually
merge Iterable and KeyedIterable into a single interface, which I think
would be a good way of simplifying the number of interfaces in the
Collections framework (same goes for Traversable / KeyedTraversable,
Iterator / KeyedIterator, and Container / KeyedContainer).

Care is taken to prevent the use of "$set[$x]" syntax to overwrite an
element or modify an element in place for Sets.

For now, Set does not implement ConstIndexAccess or Indexish. Making Set
implement these interfaces in the future might make sense, but I'd like to
punt on the decision for now.

Reviewed By: @elgenie

Differential Revision: D1435557
Update paris. No longer 100%.

Summary: Was blocked by #3155 which is now fixed.

refs #3024

Reviewed By: @JoelMarcey

Differential Revision: D1512038
Remove die() and exit()

Summary: These functions do still exist but not in HNI anymore as they were only used by the following syntax:

```php
$x = "exit";
$x();
```

Part of #3525.
Closes https://github.com/facebook/hhvm/pull/3552

Reviewed By: @sgolemon, @ptarjan

Differential Revision: D1512234
VASM part 7: use a Vreg temp in ArgGroup, finish removing m_rScratch

Summary: Finish converting remaining uses of m_rScratch to virtual (temp)
registers, and extend ArgGroup to allow srcs to be Vreg temps.
refactor shuffle2 into a copyTV helper functions.

Reviewed By: @alexmalyshev

Differential Revision: D1460426
VASM part 8: add Vloc

Summary: Vloc is like PhysLoc; its the holder for the virtual registers we
assign to an SSATmp. Helpers taking Vout generally need to take Vreg
and Vloc parameters instead of PhysReg and PhysLoc, to prepare for
the next diff, where code generation uses virtual registers for
nearly everything.

Reviewed By: @alexmalyshev

Differential Revision: D1460430
typechecker: Fix column numbers in errors.

Reviewed By: @pikatchu

Differential Revision: D1512788
lexer: Remove dead code.

Summary: While trying to grok the codebase, I realized that this function was never getting called.

Reviewed By: @elgenie

Differential Revision: D1499849
Add support for registering and using an externally supplied Profiler,

Summary: as for example from a 3rd party DSO.

While I'm at it, plumb in instantiation of the pre-existing experimental
MemoProfiler.

This PR replaces https://github.com/facebook/hhvm/pull/3082. This PR
is simpler than that proposed before, since the old work is supplanted
in large part by recent work for debugger hooks.  There were too many
git branch conflicts to warrant preserving the commentary of 3082,
most of which is no longer relevant.
Closes https://github.com/facebook/hhvm/pull/3533

Reviewed By: @ptarjan

Differential Revision: D1508210
Fix maxlinelen

Summary: Fix fgets to read up to `length -1` instead of `length`
Also fix `SplFileObject::fgets` to include the `maxLineLen`

I moved all good tests found in `standard/file`
`fgetss_basic2.php` `fgetss_variant3.php` are fixed by this diff.

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

Reviewed By: @ptarjan

Differential Revision: D1512238
Fix arcs inserted for bytecode control flow within a region

Summary: Profile translations can contain multiple blocks. So, when inserting
arcs into a region, an arc should always go from the last block in the
source profile translation to the first block in the dest profile
translation.  While inspecting the code, I found some cases where this
wasn't the case, which are fixed here.

Reviewed By: @alexmalyshev

Differential Revision: D1512204
Don't 'return' from void methods.

Summary: Fix several MemoryManager methods to simply execute their final statements,
rather than prefixing them with 'return'.

Reviewed By: @edwinsmith

Differential Revision: D1509675
Fix up walkstk command

Summary: Two fixes to `walkstk`:

- If HPHP::mcg is corrupted, use a simple heuristic (is the
  corresponding native frame a normal, nameless frame?) to decide if
  we're in the TC.  This complicates the logic a tad but makes the
  command more reliable.

- Don't omit the initial frame.

Reviewed By: @markw65

Differential Revision: D1511373
Fix bugs in `hhx` for RATA immediates

Summary: I thought I fixed some of these in a previous diff, but apparently not.

Reviewed By: @alexmalyshev

Differential Revision: D1511765