MCPcopy Create free account
hub / github.com/F-Stack/f-stack / getcached

Function getcached

freebsd/contrib/openzfs/module/lua/lvm.c:440–453  ·  view source on GitHub ↗

** 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. */

Source from the content-addressed store, hash-verified

438** new closure to be created.
439*/
440static Closure *getcached (Proto *p, UpVal **encup, StkId base) {
441 Closure *c = p->cache;
442 if (c != NULL) { /* is there a cached closure? */
443 int nup = p->sizeupvalues;
444 Upvaldesc *uv = p->upvalues;
445 int i;
446 for (i = 0; i < nup; i++) { /* check whether it has right upvalues */
447 TValue *v = uv[i].instack ? base + uv[i].idx : encup[uv[i].idx]->v;
448 if (c->l.upvals[i]->v != v)
449 return NULL; /* wrong upvalue; cannot reuse closure */
450 }
451 }
452 return c; /* return cached closure (or NULL if no cached closure) */
453}
454
455
456/*

Callers 1

luaV_executeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected