Fix cache of inlining costs and streamline the logic
commitbb3872f38c8a7572bb2a028ee9a499a6573e16e1
authorGuilherme Ottoni <ottoni@fb.com>
Tue, 15 May 2018 06:18:07 +0000 (14 23:18 -0700)
committerHhvm Bot <hhvm-bot@users.noreply.github.com>
Tue, 15 May 2018 06:23:01 +0000 (14 23:23 -0700)
tree25553c29b60d38dcda3143c2fda8e055b2addbe0
parent391662bcf3be8ca03a10e18be0751e30dd8aa556
Fix cache of inlining costs and streamline the logic

Summary:
When a unit is incomplete and the function is still being profiled, the cost
shouldn't be cached unless we're sure that the cost is going to be excessive.
The code was checking this, but there was a bug: the decision about how much is
excessive was dependent on the context where the inlining was happening.  If
this happened deep in an inlining chain, the budget left for inlining could be
very small, and so we'd prevent inlining that candidate everywhere forever.  The
fix here is simply to do the same check against the global maximum cost that we
allow for an inlining candidate.

While here, I reworked the logic to handle caching of incomplete regions.

Reviewed By: markw65

Differential Revision: D7984534

fbshipit-source-id: d84364279a79409db9bb71a22598b82f0c919084
hphp/runtime/vm/jit/inlining-decider.cpp