コード例 #1
0
ファイル: emit.cpp プロジェクト: nadanomics/hhvm
void emit_finish_func(const php::Func& func,
                      FuncEmitter& fe,
                      const EmitBcInfo& info) {
  if (info.containsCalls) fe.containsCalls = true;;

  for (auto& fpi : info.fpiRegions) {
    auto& e = fe.addFPIEnt();
    e.m_fpushOff = fpi.fpushOff;
    e.m_fcallOff = fpi.fcallOff;
    e.m_fpOff    = fpi.fpDelta;
  }

  emit_locals_and_params(fe, func, info);
  emit_ehent_tree(fe, func, info);

  fe.userAttributes = func.userAttributes;
  fe.retUserType = func.returnUserType;
  fe.originalFilename = func.originalFilename;
  fe.isClosureBody = func.isClosureBody;
  fe.isAsync = func.isAsync;
  fe.isGenerator = func.isGenerator;
  fe.isPairGenerator = func.isPairGenerator;
  if (func.nativeInfo) {
    fe.returnType = func.nativeInfo->returnType;
  }
  fe.retTypeConstraint = func.retTypeConstraint;

  fe.maxStackCells = info.maxStackDepth +
                     fe.numLocals() +
                     fe.numIterators() * kNumIterCells +
                     info.maxFpiDepth * kNumActRecCells;

  fe.finish(fe.ue().bcPos(), false /* load */);
  fe.ue().recordFunction(&fe);
}
コード例 #2
0
ファイル: emit.cpp プロジェクト: Alienfeel/hhvm
void emit_finish_func(const php::Func& func,
                      FuncEmitter& fe,
                      const EmitBcInfo& info) {
  fe.setMaxStackCells(
    info.maxStackDepth + fe.numLocals() +
      info.maxFpiDepth * kNumActRecCells
  );
  if (info.containsCalls) fe.setContainsCalls();

  for (auto& fpi : info.fpiRegions) {
    auto& e = fe.addFPIEnt();
    e.m_fpushOff = fpi.fpushOff;
    e.m_fcallOff = fpi.fcallOff;
    e.m_fpOff    = fpi.fpDelta;
  }

  emit_locals_and_params(fe, func, info);
  emit_ehent_tree(fe, func, info);

  fe.setUserAttributes(func.userAttributes);
  fe.setReturnUserType(func.returnUserType);
  fe.setOriginalFilename(func.originalFilename);
  fe.setIsClosureBody(func.isClosureBody);
  fe.setIsGenerator(func.isGeneratorBody);
  fe.setIsGeneratorFromClosure(func.isGeneratorFromClosure);
  fe.setIsPairGenerator(func.isPairGenerator);
  fe.setGeneratorBodyName(func.generatorBodyName);
  fe.setIsAsync(func.isAsync);

  fe.finish(fe.ue().bcPos(), false /* load */);
  fe.ue().recordFunction(&fe);
}