TransID ProfData::addTransPrologue(TransKind kind, const SrcKey& sk, int nArgs) { assert(kind == TransPrologue || kind == TransProflogue); TransID transId = m_numTrans++; m_transRecs.emplace_back(new ProfTransRec(transId, kind, sk, nArgs)); if (kind == TransProflogue) { // only Proflogue translations need an entry in the m_prologueDB m_prologueDB.add(sk.getFuncId(), nArgs, transId); } return transId; }
/* * Returns the last BC offset in the region that corresponds to the * function where the region starts. This will normally be the offset * of the last instruction in the last block, except if the function * ends with an inlined call. In this case, the offset of the * corresponding FCall* in the function that starts the region is * returned. */ static Offset findLastBcOffset(const RegionDescPtr region) { assert(region->blocks.size() > 0); auto& blocks = region->blocks; FuncId startFuncId = blocks[0]->start().getFuncId(); for (int i = blocks.size() - 1; i >= 0; i--) { SrcKey sk = blocks[i]->last(); if (sk.getFuncId() == startFuncId) { return sk.offset(); } } not_reached(); }
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(), (unsigned long long)sk.getFuncId(), sk.offset()).str(); }
std::string showShort(SrcKey sk) { if (!sk.valid()) return "<invalid SrcKey>"; return folly::format("{}(id {:#x})@{}{}", sk.func()->fullName()->data(), sk.getFuncId(), sk.offset(), sk.resumed() ? "r" : "").str(); }
std::string showShort(SrcKey sk) { return folly::format("{}(id 0x{:#x})@{}", sk.func()->fullName()->data(), sk.getFuncId(), sk.offset()).str(); }