Exemplo n.º 1
0
void BlockScope::addUse(BlockScopeRawPtr user, int useKinds) {
  if (is(ClassScope) ? static_cast<HPHP::ClassScope*>(this)->isUserClass() :
      is(FunctionScope) &&
      static_cast<HPHP::FunctionScope*>(this)->isUserFunction()) {

    if (user.get() == this) {
      m_selfUser |= useKinds;
      return;
    }

    Lock lock(s_depsMutex);
    Lock l2(s_jobStateMutex);
    std::pair<BlockScopeRawPtrFlagsHashMap::iterator,bool> val =
      m_userMap.insert(BlockScopeRawPtrFlagsHashMap::value_type(user,
                                                                useKinds));
    if (val.second) {
      m_orderedUsers.push_back(&*val.first);
      user->m_orderedDeps.push_back(
          std::make_pair(BlockScopeRawPtr(this), &(val.first->second)));
      ASSERT(user->getMark() != BlockScope::MarkReady &&
             user->getMark() != BlockScope::MarkWaiting);
    } else {
      val.first->second |= useKinds;
    }
  }
}
Exemplo n.º 2
0
void BlockScope::addUse(BlockScopeRawPtr user, int useKinds) {
  if ((is(ClassScope) || is(FunctionScope)) && !isBuiltin()) {

    if (user.get() == this) {
      m_selfUser |= useKinds;
      return;
    }

    Lock lock(s_depsMutex);
    Lock l2(s_jobStateMutex);
    auto val = m_userMap.emplace(user, useKinds);
    if (val.second) {
      m_orderedUsers.push_back(&*val.first);
      user->m_orderedDeps.emplace_back(BlockScopeRawPtr{this},
                                       &(val.first->second));
      assert(user->getMark() != BlockScope::MarkReady &&
             user->getMark() != BlockScope::MarkWaiting);
    } else {
      val.first->second |= useKinds;
    }
  }
}