/* check whether cached closure in prototype 'p' may be reused, that is, whether there is a cached closure with the same upvalues needed by new closure to be created.  */
static Closure* getcached(Proto *p, UpVal **encup, StkId base)
/* check whether cached closure in prototype 'p' may be reused, that is, whether there is a cached closure with the same upvalues needed by new closure to be created.  */
static Closure* getcached(Proto *p, UpVal **encup, StkId base)
{
    int nup = p->sizeupvalues;
    Upvaldesc *uv = p->upvalues;
    int i;
    for (i = 0; i < nup; i++) {
      TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v;
      if (c->l.upvals[i]->v != v)
        return NULL;
    }
  }
  return c;
}