hphp/runtime/vm/jit/regionize-func.cpp
/**
 * Add to sets coveredNodes and coveredArcs the cfg arcs that are now
 * covered given the new region containing the translations in
 * selectedVec.
 */
Add to sets coveredNodes and coveredArcs the cfg arcs that are now
covered given the new region containing the translations in
selectedVec.
Add to sets coveredNodes and coveredArcs the cfg arcs that are now covered given the new region containing the translations in selectedVec .
static void markCovered(const TransCFG& cfg, const TransIDVec selectedVec,
                        const TransIDSet heads, TransIDSet& coveredNodes,
                        TransCFG::ArcPtrSet& coveredArcs) {
  assert(selectedVec.size() > 0);
  TransID newHead = selectedVec[0];
  coveredNodes.insert(selectedVec.begin(), selectedVec.end());
  for (auto arc : cfg.inArcs(newHead)) {
    TransID src = arc->src();
    if (coveredNodes.count(src)) {
      coveredArcs.insert(arc);
    }
  }
  for (size_t i = 0; i < selectedVec.size() - 1; i++) {
    TransID node = selectedVec[i];
    TransID next = selectedVec[i + 1];
    bool foundArc = false;
    for (auto arc : cfg.outArcs(node)) {
      if (arc->dst() == next) {
        coveredArcs.insert(arc);
        foundArc = true;
      }
    }
    always_assert(foundArc);
  }
  for (auto node : selectedVec) {
    for (auto arc : cfg.outArcs(node)) {
      if (heads.count(arc->dst())) {
        coveredArcs.insert(arc);
      }
    }
  }
}
static void markCovered ( const TransCFG & cfg , const TransIDVec selectedVec , const TransIDSet heads , TransIDSet & coveredNodes , TransCFG :: ArcPtrSet & coveredArcs ) { assert ( selectedVec . size ( ) > 0 ) ; TransID newHead = selectedVec [ 0 ] ; coveredNodes . insert ( selectedVec . begin ( ) , selectedVec . end ( ) ) ; for ( auto arc : cfg . inArcs ( newHead ) ) { TransID src = arc -> src ( ) ; if ( coveredNodes . count ( src ) ) { coveredArcs . insert ( arc ) ; } } for ( size_t i = 0 ; i < selectedVec . size ( ) - 1 ; i ++ ) { TransID node = selectedVec [ i ] ; TransID next = selectedVec [ i + 1 ] ; bool foundArc = false ; for ( auto arc : cfg . outArcs ( node ) ) { if ( arc -> dst ( ) == next ) { coveredArcs . insert ( arc ) ; foundArc = true ; } } always_assert ( foundArc ) ; } for ( auto node : selectedVec ) { for ( auto arc : cfg . outArcs ( node ) ) { if ( heads . count ( arc -> dst ( ) ) ) { coveredArcs . insert ( arc ) ; } } } }
Add to sets coveredNodes and coveredArcs the cfg arcs that are now
 covered given the new region containing the translations in
 selectedVec.
Add to sets coveredNodes and coveredArcs the cfg arcs that are now covered given the new region containing the translations in selectedVec .
// Mark all region's nodes as covered. // Mark all incoming arcs into newHead from covered nodes as covered. // Mark all arcs between consecutive region nodes as covered. // Mark all outgoing arcs from the region to a head node as covered.