MCPcopy Create free account
hub / github.com/RomanKubiak/ctrlr / GCTM

Function GCTM

Source/Misc/lua/src/lua.c:6447–6473  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

6445
6446
6447static void GCTM (lua_State *L) {
6448global_State *g = G(L);
6449GCObject *o = g->tmudata->gch.next; /* get first element */
6450Udata *udata = rawgco2u(o);
6451const TValue *tm;
6452/* remove udata from `tmudata' */
6453if (o == g->tmudata) /* last element? */
6454g->tmudata = NULL;
6455else
6456g->tmudata->gch.next = udata->uv.next;
6457udata->uv.next = g->mainthread->next; /* return it to `root' list */
6458g->mainthread->next = o;
6459makewhite(g, o);
6460tm = fasttm(L, udata->uv.metatable, TM_GC);
6461if (tm != NULL) {
6462lu_byte oldah = L->allowhook;
6463lu_mem oldt = g->GCthreshold;
6464L->allowhook = 0; /* stop debug hooks during GC tag method */
6465g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */
6466setobj2s(L, L->top, tm);
6467setuvalue(L, L->top+1, udata);
6468L->top += 2;
6469luaD_call(L, L->top - 2, 0);
6470L->allowhook = oldah; /* restore hooks */
6471g->GCthreshold = oldt; /* restore threshold */
6472}
6473}
6474
6475
6476/*

Callers 2

luaC_callGCTMFunction · 0.85
singlestepFunction · 0.85

Calls 1

luaD_callFunction · 0.85

Tested by

no test coverage detected