当前位置: 首页>>代码示例>>C++>>正文


C++ SrcKey::offset方法代码示例

本文整理汇总了C++中SrcKey::offset方法的典型用法代码示例。如果您正苦于以下问题:C++ SrcKey::offset方法的具体用法?C++ SrcKey::offset怎么用?C++ SrcKey::offset使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SrcKey的用法示例。


在下文中一共展示了SrcKey::offset方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: recordActRecPush

static void recordActRecPush(const SrcKey sk,
                             const StringData* name,
                             const StringData* clsName,
                             bool staticCall) {
  auto unit = sk.unit();
  FTRACE(2, "annotation: recordActRecPush: {}@{} {}{}{} ({}static)\n",
         unit->filepath()->data(),
         sk.offset(),
         clsName ? clsName->data() : "",
         clsName ? "::" : "",
         name,
         !staticCall ? "non" : "");

  SrcKey next(sk);
  next.advance(unit);
  const FPIEnt *fpi = sk.func()->findFPI(next.offset());
  assert(fpi);
  assert(name->isStatic());
  assert(sk.offset() == fpi->m_fpushOff);
  auto const fcall = SrcKey { sk.func(), fpi->m_fcallOff, sk.resumed() };
  assert(isFCallStar(*reinterpret_cast<const Op*>(unit->at(fcall.offset()))));
  auto const func = lookupDirectFunc(sk, name, clsName, staticCall);
  if (func) {
    recordFunc(fcall, func);
  }
}
开发者ID:Ronnrein,项目名称:hhvm,代码行数:26,代码来源:annotation.cpp

示例2: show

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();
}
开发者ID:IMGM,项目名称:hiphop-php,代码行数:13,代码来源:srckey.cpp

示例3: show

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::sformat("{}:{} 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" : "",
                        sk.hasThis()  ? "t" : "",
                        sk.prologue() ? "p" : "");
}
开发者ID:MatmaRex,项目名称:hhvm,代码行数:16,代码来源:srckey.cpp

示例4: recordGdbTranslation

void recordGdbTranslation(SrcKey sk, const Func* srcFunc, const CodeBlock& cb,
                          const TCA start, const TCA end, bool exit,
                          bool inPrologue) {
  assertx(cb.contains(start) && cb.contains(end));
  if (start != end) {
    assertOwnsCodeLock();
    if (!RuntimeOption::EvalJitNoGdb) {
      Debug::DebugInfo::Get()->recordTracelet(
        Debug::TCRange(start, end, &cb == &code().cold()),
        srcFunc,
        srcFunc->unit() ? srcFunc->unit()->at(sk.offset()) : nullptr,
        exit, inPrologue
      );
    }
    if (RuntimeOption::EvalPerfPidMap) {
      Debug::DebugInfo::Get()->recordPerfMap(
        Debug::TCRange(start, end, &cb == &code().cold()),
        sk,
        srcFunc,
        exit,
        inPrologue
      );
    }
  }
}
开发者ID:shantanusharma,项目名称:hhvm,代码行数:25,代码来源:tc-record.cpp

示例5: prepareForNextHHBC

void prepareForNextHHBC(IRGS& env,
                        const NormalizedInstruction* ni,
                        SrcKey newSk,
                        bool lastBcInst) {
  FTRACE(1, "------------------- prepareForNextHHBC ------------------\n");
  env.currentNormalizedInstruction = ni;

  always_assert_flog(
    IMPLIES(isInlining(env), !env.lastBcInst),
    "Tried to end trace while inlining."
  );

  always_assert_flog(
    IMPLIES(isInlining(env), !env.firstBcInst),
    "Inlining while still at the first region instruction."
  );

  always_assert(env.bcStateStack.size() >= env.inlineLevel + 1);
  auto pops = env.bcStateStack.size() - 1 - env.inlineLevel;
  while (pops--) env.bcStateStack.pop_back();

  always_assert_flog(env.bcStateStack.back().func() == newSk.func(),
                     "Tried to update current SrcKey with a different func");

  env.bcStateStack.back().setOffset(newSk.offset());
  updateMarker(env);
  env.lastBcInst = lastBcInst;
  env.catchCreator = nullptr;
  env.irb->prepareForNextHHBC();
}
开发者ID:SmarooLOL,项目名称:hhvm,代码行数:30,代码来源:irgen.cpp

示例6: findPredTrans

static TransIDSet findPredTrans(TransID dstID,
                                const ProfData* profData,
                                const SrcDB& srcDB,
                                const TcaTransIDMap& jmpToTransID) {
  SrcKey dstSK = profData->transSrcKey(dstID);
  const SrcRec* dstSR = srcDB.find(dstSK);
  assertx(dstSR);
  TransIDSet predSet;

  for (auto& inBr : dstSR->incomingBranches()) {
    TransID srcID = folly::get_default(jmpToTransID, inBr.toSmash(),
                                       kInvalidTransID);
    FTRACE(5, "findPredTrans: toSmash = {}   srcID = {}\n",
           inBr.toSmash(), srcID);
    if (srcID != kInvalidTransID && profData->isKindProfile(srcID)) {
      auto srcSuccOffsets = profData->transLastSrcKey(srcID).succOffsets();
      if (srcSuccOffsets.count(dstSK.offset())) {
        predSet.insert(srcID);
      } else {
        FTRACE(5, "findPredTrans: WARNING: incoming branch with impossible "
               "control flow between translations: {} -> {}"
               "(probably due to side exit)\n", srcID, dstID);
      }
    }
  }

  return predSet;
}
开发者ID:191919,项目名称:hhvm,代码行数:28,代码来源:trans-cfg.cpp

示例7: addDbgGuardImpl

void addDbgGuardImpl(SrcKey sk) {
  vixl::MacroAssembler a { tx64->mainCode };

  vixl::Label after;
  vixl::Label interpReqAddr;

  // Get the debugger-attached flag from thread-local storage. Don't bother
  // saving caller-saved regs around the host call; this is between blocks.
  emitTLSLoad<ThreadInfo>(a, ThreadInfo::s_threadInfo, rAsm);

  // Is the debugger attached?
  a.   Ldr  (rAsm.W(), rAsm[dbgOff]);
  a.   Tst  (rAsm, 0xff);
  // skip jump to stubs if no debugger attached
  a.   B    (&after, vixl::eq);
  a.   Ldr  (rAsm, &interpReqAddr);
  a.   Br   (rAsm);
  if (!a.isFrontierAligned(8)) {
    a. Nop  ();
    assert(a.isFrontierAligned(8));
  }
  a.   bind (&interpReqAddr);
  TCA interpReq =
    emitServiceReq(tx64->stubsCode, REQ_INTERPRET, sk.offset(), 0);
  a.   dc64 (interpReq);
  a.   bind (&after);
}
开发者ID:cdlewis,项目名称:hhvm,代码行数:27,代码来源:debug-guards.cpp

示例8: recordActRecPush

static void recordActRecPush(const SrcKey& sk,
                             const Unit* unit,
                             const FPIEnt* fpi,
                             const StringData* name,
                             const StringData* clsName,
                             bool staticCall) {
  // sk is the address of a FPush* of the function whose static name
  // is name. The boundaries of FPI regions are such that we can't quite
  // find the FCall that matches this FuncD without decoding forward to
  // the end; this is not ideal, but is hopefully affordable at translation
  // time.
  ASSERT(name->isStatic());
  ASSERT(sk.offset() == fpi->m_fpushOff);
  SrcKey fcall;
  SrcKey next(sk);
  next.advance(unit);
  do {
    if (*unit->at(next.offset()) == OpFCall) {
      // Remember the last FCall in the region; the region might end
      // with UnboxR, e.g.
      fcall = next;
    }
    next.advance(unit);
  } while (next.offset() <= fpi->m_fcallOff);
  ASSERT(*unit->at(fcall.offset()) == OpFCall);
  if (clsName) {
    const Class* cls = Unit::lookupClass(clsName);
    bool magic = false;
    const Func* func = lookupImmutableMethod(cls, name, magic, staticCall);
    if (func) {
      recordFunc(fcall, func);
    }
    return;
  }
  const Func* func = Unit::lookupFunc(name);
  if (func && func->isNameBindingImmutable(unit)) {
    // this will never go into a call cache, so we dont need to
    // encode the args. it will be used in OpFCall below to
    // set the i->funcd.
    recordFunc(fcall, func);
  } else {
    // It's not enough to remember the function name; we also need to encode
    // the number of arguments and current flag disposition.
    int numArgs = getImm(unit->at(sk.offset()), 0).u_IVA;
    recordNameAndArgs(fcall, name, numArgs);
  }
}
开发者ID:hashaash,项目名称:hiphop-php,代码行数:47,代码来源:annotation.cpp

示例9:

void
IRTranslator::translateFCallArray(const NormalizedInstruction& i) {
  const Offset pcOffset = i.offset();
  SrcKey next = i.nextSk();
  const Offset after = next.offset();

  HHIR_EMIT(FCallArray, pcOffset, after,
            jit::callDestroysLocals(i, m_hhbcTrans.curFunc()));
}
开发者ID:RyanCccc,项目名称:hhvm,代码行数:9,代码来源:ir-translator.cpp

示例10: recordFunc

static void recordFunc(const SrcKey sk,
                       const Func* func) {
  FTRACE(2, "annotation: recordFunc: {}@{} {}\n",
         sk.unit()->filepath()->data(),
         sk.offset(),
         func->fullName()->data());

  s_callDB.insert(std::make_pair(sk, func));
}
开发者ID:DoomCircus,项目名称:hhvm,代码行数:9,代码来源:annotation.cpp

示例11: showShort

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();
}
开发者ID:shixiao,项目名称:hhvm,代码行数:10,代码来源:srckey.cpp

示例12: emit_retranslate_stub

TCA emit_retranslate_stub(CodeBlock& cb, FPInvOffset spOff,
                          SrcKey target, TransFlags trflags) {
  return emit_persistent(
    cb,
    target.resumed() ? folly::none : folly::make_optional(spOff),
    REQ_RETRANSLATE,
    target.offset(),
    trflags.packed
  );
}
开发者ID:KOgames,项目名称:hhvm,代码行数:10,代码来源:service-requests.cpp

示例13: sktrace

void sktrace(SrcKey sk, const char *fmt, ...) {
  if (!Trace::enabled) return;

  auto inst = instrToString((Op*)sk.unit()->at(sk.offset()));
  Trace::trace("%s: %20s ", show(sk).c_str(), inst.c_str());
  va_list a;
  va_start(a, fmt);
  Trace::vtrace(fmt, a);
  va_end(a);
}
开发者ID:6api,项目名称:hhvm,代码行数:10,代码来源:srckey.cpp

示例14: findLastBcOffset

/*
 * 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();
}
开发者ID:Paul-ReferralMob,项目名称:hhvm,代码行数:20,代码来源:prof-data.cpp

示例15: recordFunc

static void recordFunc(NormalizedInstruction& i,
                       const SrcKey& sk,
                       const Func* func) {
  FTRACE(2, "annotation: recordFunc: {}@{} {}\n",
         i.m_unit->filepath()->data(),
         sk.offset(),
         func->fullName()->data());

  CallRecord cr;
  cr.m_type = Function;
  cr.m_func = func;
  s_callDB.insert(std::make_pair(sk, cr));
  i.directCall = true;
}
开发者ID:7755373049,项目名称:hiphop-php,代码行数:14,代码来源:annotation.cpp


注:本文中的SrcKey::offset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。