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

Function traversetable

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

Source from the content-addressed store, hash-verified

431
432
433static lu_mem traversetable (global_State *g, Table *h) {
434 const char *weakkey, *weakvalue;
435 const TValue *mode = gfasttm(g, h->metatable, TM_MODE);
436 markobject(g, h->metatable);
437 if (mode && ttisstring(mode) && /* is there a weak mode? */
438 ((weakkey = strchr(svalue(mode), 'k')),
439 (weakvalue = strchr(svalue(mode), 'v')),
440 (weakkey || weakvalue))) { /* is really weak? */
441 black2gray(obj2gco(h)); /* keep table gray */
442 if (!weakkey) /* strong keys? */
443 traverseweakvalue(g, h);
444 else if (!weakvalue) /* strong values? */
445 traverseephemeron(g, h);
446 else /* all weak */
447 linktable(h, &g->allweak); /* nothing to traverse now */
448 }
449 else /* not weak */
450 traversestrongtable(g, h);
451 return sizeof(Table) + sizeof(TValue) * h->sizearray +
452 sizeof(Node) * cast(size_t, sizenode(h));
453}
454
455
456static int traverseproto (global_State *g, Proto *f) {

Callers 1

propagatemarkFunction · 0.70

Calls 4

strchrFunction · 0.85
traverseweakvalueFunction · 0.85
traverseephemeronFunction · 0.85
traversestrongtableFunction · 0.85

Tested by

no test coverage detected