MCPcopy Create free account
hub / github.com/DFHack/dfhack / traverseproto

Function traverseproto

depends/lua/src/lgc.c:479–498  ·  view source on GitHub ↗

** Traverse a prototype. (While a prototype is being build, its ** arrays can be larger than needed; the extra slots are filled with ** NULL, so the use of 'markobjectN') */

Source from the content-addressed store, hash-verified

477** NULL, so the use of 'markobjectN')
478*/
479static int traverseproto (global_State *g, Proto *f) {
480 int i;
481 if (f->cache && iswhite(f->cache))
482 f->cache = NULL; /* allow cache to be collected */
483 markobjectN(g, f->source);
484 for (i = 0; i < f->sizek; i++) /* mark literals */
485 markvalue(g, &f->k[i]);
486 for (i = 0; i < f->sizeupvalues; i++) /* mark upvalue names */
487 markobjectN(g, f->upvalues[i].name);
488 for (i = 0; i < f->sizep; i++) /* mark nested protos */
489 markobjectN(g, f->p[i]);
490 for (i = 0; i < f->sizelocvars; i++) /* mark local-variable names */
491 markobjectN(g, f->locvars[i].varname);
492 return sizeof(Proto) + sizeof(Instruction) * f->sizecode +
493 sizeof(Proto *) * f->sizep +
494 sizeof(TValue) * f->sizek +
495 sizeof(int) * f->sizelineinfo +
496 sizeof(LocVar) * f->sizelocvars +
497 sizeof(Upvaldesc) * f->sizeupvalues;
498}
499
500
501static lu_mem traverseCclosure (global_State *g, CClosure *cl) {

Callers 1

propagatemarkFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected