Refactor trivial equality check.

Summary: Makes it easier to add new pattern match cases.

Reviewed By: @jwatzman

Differential Revision: D1611174
Remove and '--all' and '-- [rest]' option to hh_server

Summary: They are unused.

Reviewed By: @jwatzman

Differential Revision: D1610702
Hoist out init code from ServerConvert

Summary: I am trying to isolate all the init code in one place, so that saving /
restoring state will be easy.

Reviewed By: @jwatzman

Differential Revision: D1610705
Clean up MainInit.go.

Summary: It seems like there's no need to run ServerPeriodical.init when
we are doing the one-shot hh_server --check. If so, we can easily factor
the four statements into one if-then block.

I will be refactoring the init process in subsequent commits in preparing for
the save / restore state feature, and this change helps that refactor.

Reviewed By: @jwatzman

Differential Revision: D1610704
Remove hh_server --suggest

Summary: It seems to have been replaced by the client-side suggest
interface.

Reviewed By: @jwatzman

Differential Revision: D1610703
Separate --check code from init code.

Summary: Should make it easier to see if we're saving / restoring global
state correctly.

Reviewed By: @jwatzman

Differential Revision: D1610792
Implement jumps & more in llvm backend

Summary: This diff implements enough of the llvm backend to emit the basic
shape of an entire vasm unit (but not all the contents) in my tiny test
program. All the jumps are there, along with enough other stubbed out
operations to pass the llvm verifier and make it through codegen. Since we
don't yet plumb through vmfp and vmsp, most loads are nonsense. The resulting
code from llvm is garbage, of course, so we still punt back to the x64 backend
after the end. Some of the higher-level changes not strictly related to jumps
are:

- When we see a non-virtual Vreg, we ignore it or substitute in some bogus
  value. We'll eventually need to get to a place where there are no physical
  Vregs in the vasm unit, then this code can go away.
- Install an llvm error handler so fatal errors go through our normal
  stacktrace pipeline.
- Run the llvm module verifier after emitting code for the unit.
- Add a landingpad vasm instruction, corresponding to the llvm landingpad
  instruction. It marks the beginning of a catch region and is somewhat
  analogous to the hhir BeginCatch instruction.

Reviewed By: @maksfb

Differential Revision: D1608812
Revert "An async method's return annotation (if there is one) must be "Awaitable""

Reviewed By: @elgenie
Easy cleanup of DataType

Summary: Hard cleanup forthcoming; this is the free-of-thought stuff.

Reviewed By: @jdelong

Differential Revision: D1603727
Get rid of KindOfAny in extension code

Summary: yay hooray

Reviewed By: @jdelong

Differential Revision: D1608540
Organize and document jit::Type

Summary: Trying to get rid of KindOfAny led me down this road.

Reviewed By: @swtaarrs

Differential Revision: D1608437
Deal with double nulls in an even smarter way

Summary: `Typing.non_null` attempts to deal with double nulls, but
doesn't quite do the entire job, as comes up a lot with `idx2`, see new
test case. This threads information thru `unify` and `sub_type` to deal
with that, along with starting to set up a type `apply` function which
we may eventually want to write. (I originally started trying to write
such a function, which is why this took me so long to crank out, but
ended up just doing this simpler approach.)

Reviewed By: @int3, @elgenie

Differential Revision: D1603190
Fix heap corruption in exif_ifd_make_value

Summary: CVE-2014-3670

The logic for writing float/double arrays in exif_ifd_make_value is flat out wrong. Firstly, the whole size of the target buffer is `byte_count`, yet `byte_count` is used as if it was the size of an individual element in the array.

Furthermore, the source pointer for the memmove is wrong as well. The expression `info_data->value.f` access the union (`_image_info_value`) as a float, even though it is a pointer in this case. See line 5857 for an example where - in the case of an array - the list member is derefenced properly as a pointer to an array. This ends up being simultaneous out-of-bounds read and write.

Reviewed By: @oyamauchi

Differential Revision: D1553388
Fix SplFileObject::fgets

Summary: Aims to fix #3873
Closes https://github.com/facebook/hhvm/pull/3877

Reviewed By: @paulbiss

Differential Revision: D1584282
Remove movq, movqrx, movqxr.

Summary: These were left over from the X64Assembler->VASM conversion,
we only need copy{}.

Reviewed By: @swtaarrs

Differential Revision: D1614296
De-hhvmify hhmeasure

Summary: It'd be nice to be able to use hhmeasure as a tool to comparatively
microbenchmark hhvm and other php implementations, so let's get rid of
the hhvm-specific language extensions.

I considered inlining the implementation of idx() at the callsites,
instead of defining my own. I went with this because I have a hunch that
a lot of real codebases probably define their own idx-like thing, so
this is somewhat realistic. Any thoughts?

Reviewed By: @edwinsmith

Differential Revision: D1614251
Fix a tracing bug in hhbbc

Summary: Segfaulted if you have an unnamed local in a member instruction.

Reviewed By: @edwinsmith

Differential Revision: D1605906
Add a utility to hhbbc to increase trace level for specific functions

Summary: I've done this manually many times, so let's make it a feature.

Reviewed By: @markw65

Differential Revision: D1606347
Don't propagate states past noreturn functions or Awaits that throw

Summary: Outside of FPI regions this is pretty easy to do.  Inside of them, the
restrictions on bytecode for FPI regions make this easiest to do by not
eliminating the unreachable code---this means running the abstract interpreter
on it, but we don't want any types it infers to leak into successor blocks.
Handle this by adding a new 'unreachable' flag for states and setting up the
state merge rules to handle it appropriately.  When the optimizer sees
unreachable code, it tries to remove it only if it isn't in an FPI region.

Also, change the cases where this happens to push TBottom, and fix a few bugs
where subtypeOf was being used when we really meant something else.
(TBottom.strictSubtypeOf(TObj) is true, but that doesn't mean it has specific
information about an object.)  There are other cases where we'll do things like
push TTrue if a TBottom is being tested for is_int---these are all harmless
because the code is unreachable if you have a TBottom involved.

Reviewed By: @jano

Differential Revision: D1596487
Fix a bug in how __Memoize sets up FPI regions

Summary: In this case you could have the fpushOff pointing to a non-FPush.

Reviewed By: @jano

Differential Revision: D1614957