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


C++ PUNT函数代码示例

本文整理汇总了C++中PUNT函数的典型用法代码示例。如果您正苦于以下问题:C++ PUNT函数的具体用法?C++ PUNT怎么用?C++ PUNT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


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

示例1: emitCreateCont

void emitCreateCont(IRGS& env) {
  auto const resumeOffset = nextBcOff(env);
  assertx(!resumed(env));
  assertx(curFunc(env)->isGenerator());

  if (curFunc(env)->isAsyncGenerator()) PUNT(CreateCont-AsyncGenerator);

  // Create the Generator object. CreateCont takes care of copying local
  // variables and iterators.
  auto const func = curFunc(env);
  auto const resumeSk = SrcKey(func, resumeOffset, true);
  auto const bind_data = LdBindAddrData { resumeSk, invSPOff(env) + 1 };
  auto const resumeAddr = gen(env, LdBindAddr, bind_data);
  auto const cont =
    gen(env,
        CreateCont,
        fp(env),
        cns(env, func->numSlotsInFrame()),
        resumeAddr,
        cns(env, resumeOffset));

  // The suspend hook will decref the newly created generator if it throws.
  auto const contAR =
    gen(env,
        LdContActRec,
        IsAsyncData(curFunc(env)->isAsync()),
        cont);
  suspendHookE(env, fp(env), contAR, cont);

  // Grab caller info from ActRec, free ActRec, store the return value
  // and return control to the caller.
  gen(env, StRetVal, fp(env), cont);
  auto const ret_data = RetCtrlData { offsetToReturnSlot(env), false };
  gen(env, RetCtrl, ret_data, sp(env), fp(env));
}
开发者ID:duguruiyuan,项目名称:hhvm,代码行数:35,代码来源:irgen-resumable.cpp

示例2: implInstanceOfD

SSATmp* implInstanceOfD(IRGS& env, SSATmp* src, const StringData* className) {
  /*
   * InstanceOfD is always false if it's not an object.
   *
   * We're prepared to generate translations for known non-object types, but if
   * it's Gen/Cell we're going to PUNT because it's natural to translate that
   * case with control flow TODO(#2020251)
   */
  if (TObj < src->type()) {
    PUNT(InstanceOfD_MaybeObj);
  }
  if (!src->isA(TObj)) {
    bool res = ((src->isA(TArr) && interface_supports_array(className))) ||
      (src->isA(TStr) && interface_supports_string(className)) ||
      (src->isA(TInt) && interface_supports_int(className)) ||
      (src->isA(TDbl) && interface_supports_double(className));
    return cns(env, res);
  }

  auto const checkCls = ldClassSafe(env, className);
  if (auto isInstance = implInstanceCheck(env, src, className, checkCls)) {
    return isInstance;
  }

  return gen(env, InstanceOf, gen(env, LdObjClass, src), checkCls);
}
开发者ID:Apfelfrisch,项目名称:hhvm,代码行数:26,代码来源:irgen-types.cpp

示例3: for

Word QepcadCls::IPFZT(Word r, Word A)
{
       Word A1,Ap,As,P,Ths,i,s,t;
       /* hide Ap,Ths,i,s,t; */

Step1: /* Initialize. */
                                /*Int*/ if (PCIPFZT == 'n') return(0);
                                /*Int*/ Ths = ACLOCK();
        t = 1; P = NIL; for (i = r; i >= 1; i--)
        P = COMP(i,P); i = 1;

Step2: /* Test for finitely many distinct x sub i - coordinates among
     the common zeros. */ Ap = A; As = NIL; do
        { ADV(Ap,&A1,&Ap);
        if (i > 1) A1 = PPERMV(r,A1,P); s = PUNT(r,A1);
        if (s == 2) goto Step4; else if (s == 1) goto Step3;
        As = COMP(A1,As); } while (!(Ap == NIL)); As = INV(As);
        if (!IPFZT1(r,As)) { t = 0; goto Step4; }

Step3: /* Check for completion. */ i = i + 1; if (i > r) goto Step4;
        P = PERMCY(P); goto Step2;

Step4: /* Return. */
                               /*Int*/ Ths = ACLOCK() - Ths;
                               /*Int*/ TMIPFZT[r] = TMIPFZT[r] + Ths;
        goto Return;

Return: /* Prepare for return. */
       return(t);
}
开发者ID:fchapoton,项目名称:qepcad-1,代码行数:30,代码来源:IPFZT.c

示例4: emitStaticLocInit

void emitStaticLocInit(HTS& env, int32_t locId, const StringData* name) {
  if (curFunc(env)->isPseudoMain()) PUNT(StaticLocInit);

  auto const ldPMExit = makePseudoMainExit(env);
  auto const value = popC(env);

  // Closures and generators from closures don't satisfy the "one static per
  // source location" rule that the inline fastpath requires
  auto const box = [&]{
    if (curFunc(env)->isClosureBody()) {
      return gen(env, ClosureStaticLocInit, cns(env, name), fp(env), value);
    }

    auto const cachedBox =
      gen(env, LdStaticLocCached, StaticLocName { curFunc(env), name });
    ifThen(
      env,
      [&] (Block* taken) {
        gen(env, CheckStaticLocInit, taken, cachedBox);
      },
      [&] {
        hint(env, Block::Hint::Unlikely);
        gen(env, StaticLocInitCached, cachedBox, value);
      }
    );
    return cachedBox;
  }();
  gen(env, IncRef, box);
  auto const oldValue = ldLoc(env, locId, ldPMExit, DataTypeSpecific);
  stLocRaw(env, locId, fp(env), box);
  gen(env, DecRef, oldValue);
  // We don't need to decref value---it's a bytecode invariant that
  // our Cell was not ref-counted.
}
开发者ID:bsmr-misc-forks,项目名称:hhvm,代码行数:34,代码来源:irgen-create.cpp

示例5: emitEmptyS

void emitEmptyS(IRGS& env) {
  auto const ssaPropName = topC(env, BCSPOffset{1});
  if (!ssaPropName->isA(TStr)) {
    PUNT(EmptyS-PropNameNotString);
  }

  auto const ssaCls = popA(env);
  auto const ret = cond(
    env,
    [&] (Block* taken) {
      auto propAddr = ldClsPropAddr(env, ssaCls, ssaPropName, false);
      return gen(env, CheckNonNull, taken, propAddr);
    },
    [&] (SSATmp* ptr) {
      auto const unbox = gen(env, UnboxPtr, ptr);
      auto const val   = gen(env, LdMem, unbox->type().deref(), unbox);
      return gen(env, XorBool, gen(env, ConvCellToBool, val), cns(env, true));
    },
    [&] { // Taken: LdClsPropAddr* returned Nullptr because it isn't defined
      return cns(env, true);
    });

  destroyName(env, ssaPropName);
  push(env, ret);
}
开发者ID:191919,项目名称:hhvm,代码行数:25,代码来源:irgen-sprop-global.cpp

示例6: emitIssetS

void emitIssetS(HTS& env) {
  auto const ssaPropName = topC(env, BCSPOffset{1});
  if (!ssaPropName->isA(Type::Str)) {
    PUNT(IssetS-PropNameNotString);
  }
  auto const ssaCls = popA(env);

  auto const ret = cond(
    env,
    0,
    [&] (Block* taken) {
      auto propAddr = ldClsPropAddr(env, ssaCls, ssaPropName, false);
      return gen(env, CheckNonNull, taken, propAddr);
    },
    [&] (SSATmp* ptr) { // Next: property or global exists
      return gen(env, IsNTypeMem, Type::Null, gen(env, UnboxPtr, ptr));
    },
    [&] { // Taken: LdClsPropAddr* returned Nullptr because it isn't defined
      return cns(env, false);
    }
  );

  destroyName(env, ssaPropName);
  push(env, ret);
}
开发者ID:bjori,项目名称:hhvm,代码行数:25,代码来源:irgen-sprop-global.cpp

示例7: emitBindG

void emitBindG(IRGS& env) {
  auto const name = topC(env, BCSPOffset{1});
  if (!name->isA(TStr)) PUNT(BindG-NameNotStr);
  auto const box = popV(env);
  auto const ptr = gen(env, LdGblAddrDef, name);
  destroyName(env, name);
  bindMem(env, ptr, box);
}
开发者ID:191919,项目名称:hhvm,代码行数:8,代码来源:irgen-sprop-global.cpp

示例8: emitSetG

void emitSetG(IRGS& env) {
  auto const name = topC(env, BCSPOffset{1});
  if (!name->isA(TStr)) PUNT(SetG-NameNotStr);
  auto const value   = popC(env, DataTypeCountness);
  auto const unboxed = gen(env, UnboxPtr, gen(env, LdGblAddrDef, name));
  destroyName(env, name);
  bindMem(env, unboxed, value);
}
开发者ID:191919,项目名称:hhvm,代码行数:8,代码来源:irgen-sprop-global.cpp

示例9: coalesce

void LinearScan::allocRegs(Trace* trace) {
  if (RuntimeOption::EvalHHIREnableCoalescing) {
    // <coalesce> doesn't need instruction numbering.
    coalesce(trace);
  }

  numberInstructions(trace);

  collectNatives(trace);
  computePreColoringHint();
  initFreeList();
  allocRegsToTraceAux(trace);
  // Renumber instructions, because we added spills and reloads.
  numberInstructions(trace);

  if (RuntimeOption::EvalHHIREnableRematerialization && m_slots.size() > 0) {
    // Don't bother rematerializing the trace if it has no Spill/Reload.
    if (RuntimeOption::EvalDumpIR > 5) {
      std::cout << "--------- HHIR before rematerialization ---------\n";
      trace->print(std::cout, false);
      std::cout << "-------------------------------------------------\n";
    }
    rematerialize(trace);
  }

  // assignSpillLoc needs next natives in order to decide whether we
  // can use MMX registers.
  collectNatives(trace);
  // Make sure rsp is 16-aligned.
  uint32 numSpillLocs = assignSpillLoc(trace);
  if (numSpillLocs % 2) {
    ++numSpillLocs;
  }
  assert(NumPreAllocatedSpillLocs % 2 == 0);
  if (numSpillLocs > 0) {
    preAllocSpillLoc(trace, numSpillLocs);
    if (numSpillLocs > (uint32)NumPreAllocatedSpillLocs) {
      /*
       * We only insert AllocSpill and FreeSpill when the pre-allocated
       * spill locations are not enough.
       *
       * AllocSpill and FreeSpill take the number of extra spill locations
       * besides the pre-allocated ones.
       *
       * TODO(#2044051) AllocSpill/FreeSpill are currently disabled
       * due to bugs.
       */
      PUNT(LinearScan_AllocSpill);
      insertAllocFreeSpill(trace, numSpillLocs - NumPreAllocatedSpillLocs);
    }
  }
  numberInstructions(trace);

  // record the live out register set at each instruction
  LinearScan::computeLiveOutRegs(trace);
}
开发者ID:Hshun,项目名称:hiphop-php,代码行数:56,代码来源:linearscan.cpp

示例10: emitVGetG

void emitVGetG(IRGS& env) {
  auto const name = topC(env);
  if (!name->isA(TStr)) PUNT(VGetG-NonStrName);
  auto const ptr = gen(env, LdGblAddrDef, name);
  destroyName(env, name);
  pushIncRef(
    env,
    gen(env, LdMem, TBoxedInitCell, gen(env, BoxPtr, ptr))
  );
}
开发者ID:191919,项目名称:hhvm,代码行数:10,代码来源:irgen-sprop-global.cpp

示例11: emitAGetL

void emitAGetL(HTS& env, int32_t id) {
  auto const ldrefExit = makeExit(env);
  auto const ldPMExit = makePseudoMainExit(env);
  auto const src = ldLocInner(env, id, ldrefExit, ldPMExit, DataTypeSpecific);
  if (src->type().subtypeOfAny(Type::Obj, Type::Str)) {
    implAGet(env, src);
  } else {
    PUNT(AGetL);
  }
}
开发者ID:bsmr-misc-forks,项目名称:hhvm,代码行数:10,代码来源:irgen-basic.cpp

示例12: emitRetC

void emitRetC(IRGS& env) {
  if (curFunc(env)->isAsyncGenerator()) PUNT(RetC-AsyncGenerator);

  if (isInlining(env)) {
    assertx(!resumed(env));
    retFromInlined(env);
  } else {
    implRet(env);
  }
}
开发者ID:292388900,项目名称:hhvm,代码行数:10,代码来源:irgen-ret.cpp

示例13: emitCGetG

void emitCGetG(IRGS& env) {
  auto const exit = makeExitSlow(env);
  auto const name = topC(env);
  if (!name->isA(TStr)) PUNT(CGetG-NonStrName);
  auto const ptr = gen(env, LdGblAddr, exit, name);
  destroyName(env, name);
  pushIncRef(
    env,
    gen(env, LdMem, TCell, gen(env, UnboxPtr, ptr))
  );
}
开发者ID:191919,项目名称:hhvm,代码行数:11,代码来源:irgen-sprop-global.cpp

示例14: inlSingletonSProp

void inlSingletonSProp(IRGS& env,
                       const Func* func,
                       const Op* clsOp,
                       const Op* propOp) {
  assertx(*clsOp == Op::String);
  assertx(*propOp == Op::String);

  TransFlags trflags;
  trflags.noinlineSingleton = true;

  auto exitBlock = makeExit(env, trflags);

  // Pull the class and property names.
  auto const unit = func->unit();
  auto const clsName  = unit->lookupLitstrId(getImmPtr(clsOp,  0)->u_SA);
  auto const propName = unit->lookupLitstrId(getImmPtr(propOp, 0)->u_SA);

  // Make sure we have a valid class.
  auto const cls = Unit::lookupClass(clsName);
  if (UNLIKELY(!classHasPersistentRDS(cls))) {
    PUNT(SingletonSProp-Persistent);
  }

  // Make sure the sprop is accessible from the singleton method's context.
  auto const lookup = cls->findSProp(func->cls(), propName);
  if (UNLIKELY(lookup.prop == kInvalidSlot || !lookup.accessible)) {
    PUNT(SingletonSProp-Accessibility);
  }

  // Look up the static property.
  auto const sprop   = ldClsPropAddrKnown(env, cls, propName);
  auto const unboxed = gen(env, UnboxPtr, sprop);
  auto const value   = gen(env, LdMem, unboxed->type().deref(), unboxed);

  // Side exit if the static property is null.
  auto isnull = gen(env, IsType, TNull, value);
  gen(env, JmpNZero, exitBlock, isnull);

  // Return the singleton.
  pushIncRef(env, value);
}
开发者ID:hafi4u,项目名称:hhvm,代码行数:41,代码来源:irgen-inlining.cpp

示例15: emitBindS

void emitBindS(IRGS& env) {
  auto const ssaPropName = topC(env, BCSPOffset{2});

  if (!ssaPropName->isA(TStr)) {
    PUNT(BindS-PropNameNotString);
  }

  auto const value    = popV(env);
  auto const ssaCls   = popA(env);
  auto const propAddr = ldClsPropAddr(env, ssaCls, ssaPropName, true);

  destroyName(env, ssaPropName);
  bindMem(env, propAddr, value);
}
开发者ID:191919,项目名称:hhvm,代码行数:14,代码来源:irgen-sprop-global.cpp


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