Skip to content

Commit

Permalink
Don't do branch profiling for profiling translations
Browse files Browse the repository at this point in the history
Reviewed By: markw65

Differential Revision: D4435131

fbshipit-source-id: 0eff93f31119627615ecdbe7955fa5c2bfaeba4b
  • Loading branch information
mxw authored and hhvm-bot committed Jan 20, 2017
1 parent 93bafd8 commit bc7728c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 5 deletions.
18 changes: 18 additions & 0 deletions hphp/runtime/vm/jit/types.h
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,24 @@ inline std::string show(TransKind k) {
not_reached();
}

inline bool isProfiling(TransKind k) {
switch (k) {
case TransKind::Profile:
case TransKind::ProfPrologue:
return true;

case TransKind::Anchor:
case TransKind::Interp:
case TransKind::Live:
case TransKind::LivePrologue:
case TransKind::Optimize:
case TransKind::OptPrologue:
case TransKind::Invalid:
return false;
}
always_assert(false);
}

inline bool isPrologue(TransKind k) {
switch (k) {
case TransKind::LivePrologue:
Expand Down
11 changes: 6 additions & 5 deletions hphp/runtime/vm/jit/vasm-x64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1043,11 +1043,12 @@ void optimizeX64(Vunit& unit, const Abi& abi, bool regalloc) {

assertx(checkWidths(unit));

if (abi.canSpill && RuntimeOption::EvalProfBranchSampleFreq > 0) {
// Only profile branches if we're allowed to spill (and if branch profiling
// is on, of course). This is not only for the freedom to generate
// arbitrary code, but also because we don't want to profile unique stubs
// and such.
if (unit.context && isProfiling(unit.context->kind) && abi.canSpill &&
RuntimeOption::EvalProfBranchSampleFreq > 0) {
// Even when branch profiling is on, we still only want to profile
// non-profiling translations of PHP functions. We also require that we
// can spill, so that we can generate arbitrary profiling code, and also to
// ensure we don't profile unique stubs and such.
profile_branches(unit);
}

Expand Down

0 comments on commit bc7728c

Please sign in to comment.