Пример #1
0
std::string showShort(SrcKey sk) {
    if (!sk.valid()) return "<invalid SrcKey>";
    return folly::format(
               "{}(id {:#x})@{}{}",
               sk.func()->fullName(),
               sk.funcID(),
               sk.offset(),
               sk.resumed() ? "r" : ""
           ).str();
}
Пример #2
0
SrcKey RegionDesc::lastSrcKey() const {
  assertx(!empty());
  FuncId startFuncId = start().funcID();
  for (int i = m_blocks.size() - 1; i >= 0; i--) {
    SrcKey sk = m_blocks[i]->last();
    if (sk.funcID() == startFuncId) {
      return sk;
    }
  }
  always_assert(0);
}
Пример #3
0
TransID ProfData::addTransPrologue(TransKind kind, SrcKey sk,
                                   int nArgs) {
  assertx(kind == TransKind::Prologue || kind == TransKind::Proflogue);
  TransID transId = m_numTrans++;
  m_transRecs.emplace_back(new ProfTransRec(transId, kind, sk, nArgs));
  if (kind == TransKind::Proflogue) {
    // only Proflogue translations need an entry in the m_prologueDB
    m_prologueDB.add(sk.funcID(), nArgs, transId);
  }
  return transId;
}
Пример #4
0
std::string show(SrcKey sk) {
    auto func = sk.func();
    auto unit = sk.unit();
    const char *filepath = "*anonFile*";
    if (unit->filepath()->data() && unit->filepath()->size()) {
        filepath = unit->filepath()->data();
    }
    return folly::format("{}:{} in {}(id 0x{:#x})@{: >6}{}",
                         filepath, unit->getLineNumber(sk.offset()),
                         func->isPseudoMain() ? "pseudoMain"
                         : func->fullName()->data(),
                         (uint32_t)sk.funcID(), sk.offset(),
                         sk.resumed() ? "r" : "").str();
}
Пример #5
0
bool profileSrcKey(SrcKey sk) {
  if (!shouldPGOFunc(*sk.func())) return false;
  if (profData()->optimized(sk.funcID())) return false;
  if (profData()->profiling(sk.funcID())) return true;

  // Don't start profiling new functions if the size of either main or
  // prof is already above Eval.JitAMaxUsage and we already filled hot.
  auto tcUsage = std::max(code().main().used(), code().prof().used());
  if (tcUsage >= CodeCache::AMaxUsage && !code().hotEnabled()) {
    return false;
  }

  // We have two knobs to control the number of functions we're allowed to
  // profile: Eval.JitProfileRequests and Eval.JitProfileBCSize. We profile new
  // functions until either of these limits is exceeded. In practice we expect
  // to hit the bytecode size limit first but we keep the request limit around
  // as a safety net.
  if (RuntimeOption::EvalJitProfileBCSize > 0 &&
      profData()->profilingBCSize() >= RuntimeOption::EvalJitProfileBCSize) {
    return false;
  }

  return requestCount() <= RuntimeOption::EvalJitProfileRequests;
}
Пример #6
0
TransID ProfData::addTransProflogue(SrcKey sk, int nArgs) {
  auto transId = m_numTrans++;
  m_transRecs.emplace_back(new ProfTransRec(sk, nArgs));
  m_proflogueDB.emplace(std::make_tuple(sk.funcID(), nArgs), transId);
  return transId;
}