Allow negative TransIDs in certain contexts

Summary: For the new inlining stuff, we need to be able to convert negative
BlockIds into nontrivial ProfSrcKeys, so that we can correctly track the
set of instructions that need interpreting, but without changing the
behavior of anything else.

We're already using JIT::BlockIds and TransIDs in a very transparent
manner, so let's just give them the same types and logical ranges.

Reviewed By: @ottoni

Differential Revision: D1444737
Check !typeMightRelax in simplifyConvObjToBool()

Reviewed By: @alexmalyshev

Differential Revision: D1635364
Move all inlining work to translateRegion()

Summary: Rather than inlining from the tracelet selector (or, more generally,
making the inlining decision in any particular region selector), let's
instead move the entire process into the translation path.  This gives
us inlining support for all regions, and is just generally nicer:

- We can, and have, turned off inlining for profiling translations.  The
  hottrace selector will still support inlining, since it does its own
  decision-making on the stitched-together region, but profiling
  translations are back to being single-block.

- Part of the inlining decision involves inspecting the callee's region,
  and inspecting a fully-formed region seems cleaner than looking
  through a region-that-has-been-formed-up-until-the-FCall-hopefully.

First-order inlining for hottrace regions may also allows us to inline
more calls in cases where we have more information.

The most prominent change to note is that inlined callees' blocks are no
longer included in the caller's region; instead, we just skip emitting
the FCall in HhbcTranslator and emit the callee region instead.

Because we no longer see the in-callee uses of types for profiling
tracelets, we duplicate the inlining decision-making during profiling
translations, and if a callee is inlinable, we constrain the types of
all of its arguments, to avoid losing out on an inlining opportunity.

Reviewed By: @swtaarrs

Differential Revision: D1428014
Don't attempt to autoload ints from is_a()

Summary: Fixes facebook/hhvm#4337

Reviewed By: @paulbiss, @elgenie

Differential Revision: D1701715

Signature: t1:1701715:1416874204:20c909c2e95a108273c9e2a67f0849f01f72f653
Turn off most of insertPhis

Summary: It's using incorrect values from predecessor blocks because it doesn't
distinguish between states on the taken or next edge.  Also this isn't the
place we want to do this long term (LCM pass or something should do it
instead).  We can't turn off the stacks yet, though.

Reviewed By: @swtaarrs

Differential Revision: D1698939
Move LocalStateHook driving out of FrameStateMgr

Summary: This lets refcount opts talk to it directly.  But it still requires a
FrameStateMgr& for now to be able to call MInstrEffects::get (which wants to
read the old type of a local on the other side of a pointer, and is assuming
FrameStateMgr knows what that type is, although it only kinda does (not really
sound after gen time)).  Also gets rid of forEachFrame (unused) and makes the
forEachLocal callback match how it's used.

walkAllInlinedLocals also only has a single callsite now, which needs it
because of the skipFrame stuff.  (You can't null the locals out more than once
or refcount opts thinks it's consuming things too many times.)

Reviewed By: @swtaarrs

Differential Revision: D1699847
Remove runtime/test/refcount-opts.cpp

Summary: It's the only user of FrameStateMgr's second constructor, which I want
to remove, and you can't pass a dummy marker to the normal constructor instead
as we end up hitting hasFunc assertions (which looks like it's explicitly
testing that it's not a dummy).  I could make it work (or leave the
constructor), but I think this test's days are numbered anyway, since we're
going to need to change how the refcount-opts pass works pretty fundamentally
for it to support arbitrary control flow.  So unless someone really likes it
can I delete it?

Reviewed By: @swtaarrs

Differential Revision: D1699848

Signature: t1:1699848:1416854866:70d6f636671ac0dd6c46773702e296b2d7003bc9
Fix frameSpansCall bugs, remove 'clearing' code and add m_status asserts

Summary: There was no merging at all of the frameSpansCall state, and the way
we handled it at a loop header or with an unprocessed pred was incorrect (it
left it dangling as whatever it used to be).  Rename it to make it clearer that
it's may-information, and refactor the various clear/reset state functions so
they don't exist anymore.  Expanded m_status with some assertions: it's pretty
clear with the status assertions that this class is still doing 3 unrelated
things (finding a fixed point, dag-only-legacy-reoptimize-or-analyze-stuff, and
the building mode), so it should be split up further.

Reviewed By: @swtaarrs

Differential Revision: D1699849

Signature: t1:1699849:1416856507:403366c23fa1471eaa1ded1486725ed93b83ad15
Remove LocalStateHook& from startBlock

Summary: Refcount opts doesn't support loops (or user-level dags), and is the
only user, so we can remove this code.

Reviewed By: @swtaarrs

Differential Revision: D1699850
Remove HhbcTranslator::replace

Summary: Probably dates to when EvalStack was a member of HhbcTranslator.

Reviewed By: @swtaarrs

Differential Revision: D1699851

Signature: t1:1699851:1416854158:f9374084856b9ea46433145241f91ced04479c25
Remove marker from FrameState

Summary: It seemed weird to duplicate spOff and curFunc with the marker, and
then I was a little worried that it isn't handle the same way for merging.  It
turns out it wasn't broken, just not necessary: ir-builder is just storing its
next-to-gen-marker there for presumably historical reasons.

This also changes splitEdge to use the marker from the source jump instead of
the destination, which seems to make more sense to me, but I think we could
choose either.

Reviewed By: @alexmalyshev

Differential Revision: D1699852

Signature: t1:1699852:1416889935:4735fb88a4ec8ed3f24a4d5937275e3fa7d2319b
Fix bundled PCRE build

Summary: Do not pass the "REQUIRED" argument when finding PCRE, since we now have
a bundled PCRE which we can use in the absence of a system library. The
only effect of REQUIRED was to make FIND_PACKAGE_HANDLE_STANDARD_ARGS()
fail with an error.
Closes https://github.com/facebook/hhvm/pull/4342

Reviewed By: @fredemmott

Differential Revision: D1706218

Signature: t1:1706218:1417023737:6d291bcddb6dd21273e12263614e4a59524b3d09
Codemod "const Ref&" to "const Ref"

Summary: Not much of a codemod since there's only 2 code sites to change...

Reviewed By: @edwinsmith

Differential Revision: D1702707

Signature: t1:1702707:1416937381:a4de3760f52219a82ca47a1f7cae4e0a85aab08b
Restarting should just start the server if one isn't already running.

Summary: I think this behavior is more convenient. It would have made testing
the saved state behavior easier, for one. Also, things like `service` on Linux
operate the same way.

Reviewed By: @elgenie

Differential Revision: D1704053

Signature: t1:1704053:1416995526:7d02ea3d138445566fb38dc9aab3c73a15b809de
Break up macros.h

Summary: Moved parts of macros.h to object-data.h, resource-data.h,
type-string.h, and a new classname-is.h that just has the guts
of the CLASSNAME_IS macro, which is still shared between concrete
objects and resources.

Reviewed By: @alexmalyshev

Differential Revision: D1706380

Signature: t1:1706380:1417030686:28ddcb5a815e5fbb79295ed8fb02e37508d3c8e9
Add a CPU timer to RequestInjectionData

Summary: We'd like to be able to kill a runaway CPU-eating request before it
hits the full wall-time timeout.  Requests generally use a lot less CPU than
wall time, so we should be able to be more aggressive with it.

Reviewed By: @markw65

Differential Revision: D1702049
Quote the path passed to hh_server

Summary: When hh_client spawns a server, quote the path so that paths with spaces in the
name are correctly handled.

Fixes #4310

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

Reviewed By: @​svcscm

Differential Revision: D1701186

Pulled By: @int3
Fix a frame state tracing bug I introduced

Summary: If you turn tracing up too high now you get folly::format exceptions.

Reviewed By: @bertmaher, @alexmalyshev

Differential Revision: D1708102

Signature: t1:1708102:1417061596:3674837cec575ff003de9845fe73f02139d5d58e
Revert "Move all inlining work to translateRegion()"

Summary: This reverts commit 7a17649306b003c961a86e9e33b5bb92e979192e.

Perflab says it broke lots of things.

Reviewed By: @jdelong

Differential Revision: D1709049

Signature: t1:1709049:1417208800:3f72a2a4d47968d7db9ae906c71ab28c54929041
Fix predicted local type invariant failure (test/slow/ext_collator/1810.php)

Summary: It looks like this test is failing in trunk?  This fixes it, and is
definitely a bug fix (because we might only have Gen for the local now even if
we had a LdLoc that knew more earlier, so taking this prediction could lead to
an invariant violation of exactly this sort).  I didn't think through all the
details of why exactly it failed though.

Reviewed By: @markw65

Differential Revision: D1708111

Signature: t1:1708111:1417210961:f0d864b7a9cd844d83f21411e050079150f3255b