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


C++ ExpressionPtr::setCanonID方法代码示例

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


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

示例1: getCanonical

ExpressionPtr AliasManager::getCanonical(ExpressionPtr e) {
  unsigned val = (e->getCanonHash() % MaxBuckets) + 1;

  BucketMapEntry &em = m_bucketMap[val];

  ExpressionPtr c = em.find(e);

  if (!c) {
    add(em, e);
    c = e;
    e->setCanonPtr(ExpressionPtr());
  } else {
    e->setCanonID(c->getCanonID());
    e->setCanonPtr(c);
  }

  return c;
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:18,代码来源:alias_manager.cpp

示例2: visit

void ExprDict::visit(ExpressionPtr e) {
  assert(m_canonIdMap.size() == m_canonTypeMap.size());
  if (m_am.insertForDict(e)) {
    // we've never seen e's structure before, so record it
    record(e);
    if (e->getCanonID() >= m_canonTypeMap.size()) {
      m_canonTypeMap.resize(e->getCanonID() + 1);
      m_canonIdMap.resize(e->getCanonID() + 1);
    }
    m_canonTypeMap[e->getCanonID()] =
      TypePtrIdxPair(extractTypeAssertion(e), e->getCanonID());
    m_canonIdMap[e->getCanonID()] = e->getCanonID();
  } else if (e->isTypeAssertion()) {
    TypePtrIdxPairVec types;
    assert(isCanonicalStructure(e->getCanonID()));
    getTypes(e->getCanonID(), types);
    TypePtrIdxPair entry;
    if (containsAssertion(e->getAssertedType(), types, entry)) {
      e->setCanonID(entry.second);
    } else {
      // new type assertion seen, record it
      int oldId = e->getCanonID();
      assert(isCanonicalStructure(oldId));
      record(e);
      // insert it into the list
      if (e->getCanonID() >= m_canonTypeMap.size()) {
        m_canonTypeMap.resize(e->getCanonID() + 1);
        m_canonIdMap.resize(e->getCanonID() + 1);
      }
      m_canonIdMap[e->getCanonID()] = oldId;
      TypePtrIdxPair &head = m_canonTypeMap[oldId];
      int oldSecond = head.second;
      head.second = e->getCanonID();
      m_canonTypeMap[e->getCanonID()] =
        TypePtrIdxPair(e->getAssertedType(), oldSecond);
    }
  }
}
开发者ID:CyaLiven,项目名称:hiphop-php,代码行数:38,代码来源:expr_dict.cpp

示例3: record

void Dictionary::record(ExpressionPtr e) {
  e->setCanonID(m_idMap.size());
  m_idMap.push_back(e);
}
开发者ID:524777134,项目名称:hiphop-php,代码行数:4,代码来源:dictionary.cpp

示例4: canonicalizeNode

ExpressionPtr AliasManager::canonicalizeNode(ExpressionPtr e) {
  e->setCanonPtr(ExpressionPtr());
  e->setCanonID(0);

  switch (e->getKindOf()) {
  case Expression::KindOfObjectMethodExpression:
  case Expression::KindOfDynamicFunctionCall:
  case Expression::KindOfSimpleFunctionCall:
  case Expression::KindOfNewObjectExpression:
    add(m_bucketMap[0], e);
    break;

  case Expression::KindOfListAssignment:
    add(m_bucketMap[0], e);
    break;

  case Expression::KindOfAssignmentExpression: {
    AssignmentExpressionPtr ae = spc(AssignmentExpression,e);
    if (e->getContext() & Expression::DeadStore) {
      Construct::recomputeEffects();
      return ae->getValue();
    }
    ExpressionPtr rep;
    int interf = findInterf(ae->getVariable(), false, rep);
    if (interf == SameAccess) {
      switch (rep->getKindOf()) {
      default:
        break;
      case Expression::KindOfAssignmentExpression:
        {
          AssignmentExpressionPtr a = spc(AssignmentExpression, rep);
          ExpressionPtr value = a->getValue();
          if (a->getValue()->getContext() & Expression::RefValue) {
            break;
          }
        }
      case Expression::KindOfUnaryOpExpression:
      case Expression::KindOfBinaryOpExpression:
        rep->setContext(Expression::DeadStore);
        break;
      }
    }
    add(m_bucketMap[0], e);
    break;
  }

  case Expression::KindOfConstantExpression:
  case Expression::KindOfSimpleVariable:
  case Expression::KindOfDynamicVariable:
  case Expression::KindOfArrayElementExpression:
  case Expression::KindOfObjectPropertyExpression:
  case Expression::KindOfStaticMemberExpression:
    if (!(e->getContext() & (Expression::AssignmentLHS|
                             Expression::DeepAssignmentLHS|
                             Expression::OprLValue))) {
      if (!(e->getContext() & (Expression::LValue|
                               Expression::RefValue|
                               Expression::RefParameter|
                               Expression::UnsetContext))) {
        ExpressionPtr rep;
        int interf = findInterf(e, true, rep);
        if (interf == SameAccess) {
          if (rep->getKindOf() == e->getKindOf()) {
            e->setCanonID(rep->getCanonID());
            e->setCanonPtr(rep);
            return ExpressionPtr();
          }
          if (rep->getKindOf() == Expression::KindOfAssignmentExpression) {
            ExpressionPtr rhs = spc(AssignmentExpression,rep)->getValue();
            if (rhs->is(Expression::KindOfScalarExpression)) {
              rhs = rhs->clone();
              getCanonical(rhs);
              return rhs;
            }
            e->setCanonPtr(rhs);
          }
        }
      }
      add(m_bucketMap[0], e);
    } else {
      getCanonical(e);
    }
    break;

  case Expression::KindOfBinaryOpExpression: {
    BinaryOpExpressionPtr bop = spc(BinaryOpExpression, e);

    int rop = getOpForAssignmentOp(bop->getOp());
    if (rop) {
      ExpressionPtr lhs = bop->getExp1();
      ExpressionPtr rep;
      if (bop->getContext() & Expression::DeadStore) {
        Construct::recomputeEffects();
        ExpressionPtr rhs = bop->getExp2()->clone();
        lhs = lhs->clone();
        lhs->clearContext(Expression::LValue);
        lhs->clearContext(Expression::NoLValueWrapper);
        lhs->clearContext(Expression::OprLValue);
        rep = ExpressionPtr
          (new BinaryOpExpression(e->getLocation(),
//.........这里部分代码省略.........
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:101,代码来源:alias_manager.cpp

示例5: add

void AliasManager::add(BucketMapEntry &em, ExpressionPtr e) {
  em.add(e);
  e->setCanonID(m_nextID++);
}
开发者ID:scottmac,项目名称:hiphop-dev,代码行数:4,代码来源:alias_manager.cpp


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