hphp/runtime/vm/verifier/check_func.cpp
/**
 * Check the edge b->t, given the current state at the end of b.
 * If this is the first edge ->t we've seen, copy the state to t.
 * Otherwise, require the state exactly match.
 */
Check the edge b->t, given the current state at the end of b.
If this is the first edge ->t we've seen, copy the state to t.
Otherwise, require the state exactly match.
Check the edge b - > t given the current state at the end of b . If this is the first edge - > t we ' ve seen copy the state to t . Otherwise require the state exactly match .
bool FuncChecker::checkEdge(Block* b, const State& cur, Block *t) {
  bool ok = true;
  State& state = m_info[t->id].state_in;
  if (!state.stk) {
    copyState(&state, &cur);
    return false;
  }
  if (state.stklen != cur.stklen) {
    reportStkMismatch(b, t, cur);
    return false;
  }
  for (int i = 0, n = cur.stklen; i < n; i++) {
    if (state.stk[i] != cur.stk[i]) {
      error("mismatch on edge B%d->B%d, current %s target %s\n",
             b->id, t->id, stkToString(n, cur.stk).c_str(),
             stkToString(n, state.stk).c_str());
      return false;
    }
  }
  if (state.fpilen != cur.fpilen) {
    error("FPI stack depth mismatch on edge B%d->B%d, "
           "current %d target %d\n", b->id, t->id, cur.fpilen, state.fpilen);
    return false;
  }
  for (int i = 0, n = cur.fpilen; i < n; i++) {
    if (state.fpi[i] != cur.fpi[i]) {
      error("FPI mismatch on edge B%d->B%d, current %s target %s\n",
             b->id, t->id, fpiToString(cur.fpi[i]).c_str(),
             fpiToString(state.fpi[i]).c_str());
      return false;
    }
  }
  if (false ) {
    for (int i = 0, n = numIters(); i < n; i++) {
      if (state.iters[i] != cur.iters[i]) {
        error("mismatched iterator state on edge B%d->B%d, "
               "current %s target %s\n", b->id, t->id,
               iterToString(cur).c_str(), iterToString(state).c_str());
        return false;
      }
    }
  }
  return ok;
}
bool FuncChecker :: checkEdge ( Block * b , const State & cur , Block * t ) { bool ok = true ; State & state = m_info [ t -> id ] . state_in ; if ( ! state . stk ) { copyState ( & state , & cur ) ; return false ; } if ( state . stklen != cur . stklen ) { reportStkMismatch ( b , t , cur ) ; return false ; } for ( int i = 0 , n = cur . stklen ; i < n ; i ++ ) { if ( state . stk [ i ] != cur . stk [ i ] ) { error ( " \n " , b -> id , t -> id , stkToString ( n , cur . stk ) . c_str ( ) , stkToString ( n , state . stk ) . c_str ( ) ) ; return false ; } } if ( state . fpilen != cur . fpilen ) { error ( " " " \n " , b -> id , t -> id , cur . fpilen , state . fpilen ) ; return false ; } for ( int i = 0 , n = cur . fpilen ; i < n ; i ++ ) { if ( state . fpi [ i ] != cur . fpi [ i ] ) { error ( " \n " , b -> id , t -> id , fpiToString ( cur . fpi [ i ] ) . c_str ( ) , fpiToString ( state . fpi [ i ] ) . c_str ( ) ) ; return false ; } } if ( false ) { for ( int i = 0 , n = numIters ( ) ; i < n ; i ++ ) { if ( state . iters [ i ] != cur . iters [ i ] ) { error ( " " " \n " , b -> id , t -> id , iterToString ( cur ) . c_str ( ) , iterToString ( state ) . c_str ( ) ) ; return false ; } } } return ok ; }
Check the edge b->t, given the current state at the end of b.
Check the edge b - > t given the current state at the end of b .
// Check stack. // Check FPI stack. // Check iterator variable state. /* TODO(#1097182): Iterator verification disabled */