MCPcopy Create free account
hub / github.com/EmmyLua/EmmyLuaDebugger / traversetable

Function traversetable

third-party/lua-5.2.4/src/lgc.c:434–454  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

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

Callers 1

propagatemarkFunction · 0.70

Calls 3

traverseweakvalueFunction · 0.70
traverseephemeronFunction · 0.70
traversestrongtableFunction · 0.70

Tested by

no test coverage detected