Added primitives for generic constraints

Summary: I added a check in Typing_subtype to allow for generics to have a
primitive type as a constraint.

Reviewed By: @jwatzman

Differential Revision: D1523271
Support for HH_FIXME

Summary: It's sometimes difficult to fix all the typing errors at once.
This problem occurs when we try to convert a core library or when
we introduce a new check that reveals a lot of typing errors.

This diff adds support for a new construction: one can now add
/* HH_FIXME[ERROR_NUMBER] */ on the line that contains an error and
the error will be ignored by the type-checker.

We hope that this will help us to crowdsource the conversion effort.

Reviewed By: @jwatzman, @elgenie

Differential Revision: D1517560
Fix typo that snuck into one of the vasm diffs.

Summary: Looking at the way newIdx is used, the typo means we could get
down the "idx not const" path, then use newIdxReg which should
be valid, because ContArUpdateIdx is not whitelisted in
mayUseConst(). I think we're dodging the bullet but this needs
fixing anyway.

Reviewed By: @swtaarrs

Differential Revision: D1536301
Remove m_extra from SimpleFunctionCall

Summary: Honestly, I have no idea what this is doing, but the assert is firing
and@markw65 said it's OK to remove, so here we are.

Reviewed By: @jdelong

Differential Revision: D1536384
Fix read of uninitialized stack in AGetL interp

Summary: If an interpreted AGetL ended up fataling or otherwise encountering an
exception, it would read an uninitialized stack slot during unwinding.
Make sure it's initialized to uninit-null instead. This will never be
seen by user code; either it will be overwritten by the right classref
or we'll unwind past it.

Reviewed By: @jdelong

Differential Revision: D1536360
Skip inited checks for classes with all persistent static props

Summary: If they're all persistent, there's nothing to do.

Reviewed By: @jdelong

Differential Revision: D1536359
`preg_match_all` matches is optional

Summary: Docs agree. Easy to do. Also change a `null` to `array()`
default, even though it doesn't matter, just to be suggestive to readers
(esp. if we ever give it a real type annotation).

Reviewed By: @elgenie

Differential Revision: D1536936
Be more conservative about HNI types when there are InterceptableFunctions

Summary: Since the list of interceptable functions is user supplied it really
makes sense that we should not have to change systemlib files based on it.

Reviewed By: @bertmaher

Differential Revision: D1534975
typechecker: change error reporting location for emacs/vim

Summary: ... instead of creating a ragged edge by adding the error
 code at the beginning of the primary error location, instead
 add it to the end of the line.

== before: ragged left edge ==

   File "DynamicYield_call1.php", line 22, characters 23-28:
   Typing[4053] The method getBar is undefined in an object of type Foo
   File "DynamicYield_call1.php", line 22, characters 15-17:
   Check this out

   [next error]

== after: no ragged edge ==

   File "DynamicYield_call1.php", line 22, characters 23-28:
   The method getBar is undefined in an object of type Foo (Typing[4053])
   File "DynamicYield_call1.php", line 22, characters 15-17:
   Check this out

   [next error]

Reviewed By: @pikatchu

Differential Revision: D1537058
typechecker: report error codes for hh_client / json (1/2)

Summary: ... when no --from argument is supplied, the error printing
 goes down a different path. After this diff, that path includes the
 error code at the end of the line for the primary error. So:

  <file>:54,56: Invalid argument (Typing[4110])

 The json output also gains a "code" field.

Reviewed By: @jwatzman

Differential Revision: D1537048
Keep track and set a limit on the number of cloned closures

Summary: We've had problems in the past caused by this code, and we're again
seeing OOM crashes while cloning closures.  This diff adds
instrumentation to keep track of how many cloned closures are created,
and asserts that it doesn't go past a limit provided by a runtime
option.

Reviewed By: @mclarkelauer

Differential Revision: D1531645
Enable most optimizations on loopy translations.

Summary: Only refcount-opts is disabled.

Reviewed By: @ottoni

Differential Revision: D1531690
Correct spelling of 'pseudomain'

Summary: We had it as psuedomain in several places.

Reviewed By: @bertmaher

Differential Revision: D1536955
Add runtime support for null-safe method call operator "?->"

Summary: Hack supports instance method calls via the "->" operator, which throws if
the base is null (or any non-object type). This diff adds HHVM runtime
support for null-safe instance methods calls via a new operator "?->".

Method calls using the "?->" operator will return null if the base is null.
If the base is non-null, the "?->" operator behaves the same as "->". For
now using the "?->" operator to access properties not support and will
cause an error at parse time, though support could be added in the future
if desired. At present the "?->" operator punts to the interpreter when the
base is null; JIT support will be addressed in a separate diff.

Reviewed By: @elgenie

Differential Revision: D1524304
Don't drop FP in FrameState when entering a loop header.

Summary: Now that we only have one FP per frame, we no longer need this.

Reviewed By: @ottoni

Differential Revision: D1531721
typechecker: report error codes for hh_client / json (2/2)

Summary: ... when no --from argument is supplied, the error printing
 goes down a different path. After this diff, that path includes the
 error code at the end of the line for the primary error. So:

  <file>:54,56: Invalid argument (Typing[4110])

 The json output also gains a "code" field.

Reviewed By: @jwatzman

Differential Revision: D1537048
typechecker: annotate explode()

Summary: ... it's common enough that it should catch errors. There's one case (empty delimiter) where ##false## is returned, but that's not sufficiently common to matter.

Reviewed By: @jwatzman

Differential Revision: D1536358
Add typechecker support for null-safe method call operator "?->"

Summary: Hack supports instance method calls via the "->" operator, which throws if
the base is null (or any non-object type). This diff adds Hack typechecker
support for null-safe instance methods calls via a new operator "?->".

Method calls using the "?->" operator will return null if the base is null.
If the base is non-null, the "?->" operator behaves the same as "->". For
now using the "?->" operator to access properties not support and will
cause an error at parse time, though support could be added in the future
if desired.

This diff follows the scheme suggested by@jwatzman, where "?->" is
converted into a ternary expression during the naming phase, which has the
advantage that it avoids the need to update typing logic or other code that
works with the naming ast (nast).

Reviewed By: @elgenie, @jwatzman

Differential Revision: D1524942
Initial vasm -> llvm backend

Summary: This can't emit any useful code yet, but I'm going to spend some time
working on vasm before I can make more progress so I'd rather get this in
now. It contains shell code to convert vasm to llir and emit machine code from
that, with support for punting if an unsupported operation is encountered. I
wrote up maybe-correct translations for a couple instructions and verified that
llvm is able to at least emit some code into a, and we're able to rewind the
frontier and then emit real code using vasm-x64.

Reviewed By: @jasone

Differential Revision: D1534862
Remove dead field from ActRec.

Summary: Comment says this was used by debugger macros, but grepping for
"m_savedRbp" or "Rbp" shows nothing.

The field was part of a union, so the size of ActRec hasn't changed.

Reviewed By: @markw65

Differential Revision: D1537639