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

Function atomic

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

Source from the content-addressed store, hash-verified

997
998
999static l_mem atomic (lua_State *L) {
1000 global_State *g = G(L);
1001 l_mem work = -cast(l_mem, g->GCmemtrav); /* start counting work */
1002 GCObject *origweak, *origall;
1003 lua_assert(!iswhite(obj2gco(g->mainthread)));
1004 markobject(g, L); /* mark running thread */
1005 /* registry and global metatables may be changed by API */
1006 markvalue(g, &g->l_registry);
1007 markmt(g); /* mark basic metatables */
1008 /* remark occasional upvalues of (maybe) dead threads */
1009 remarkupvals(g);
1010 propagateall(g); /* propagate changes */
1011 work += g->GCmemtrav; /* stop counting (do not (re)count grays) */
1012 /* traverse objects caught by write barrier and by 'remarkupvals' */
1013 retraversegrays(g);
1014 work -= g->GCmemtrav; /* restart counting */
1015 convergeephemerons(g);
1016 /* at this point, all strongly accessible objects are marked. */
1017 /* clear values from weak tables, before checking finalizers */
1018 clearvalues(g, g->weak, NULL);
1019 clearvalues(g, g->allweak, NULL);
1020 origweak = g->weak; origall = g->allweak;
1021 work += g->GCmemtrav; /* stop counting (objects being finalized) */
1022 separatetobefnz(L, 0); /* separate objects to be finalized */
1023 markbeingfnz(g); /* mark objects that will be finalized */
1024 propagateall(g); /* remark, to propagate `preserveness' */
1025 work -= g->GCmemtrav; /* restart counting */
1026 convergeephemerons(g);
1027 /* at this point, all resurrected objects are marked. */
1028 /* remove dead objects from weak tables */
1029 clearkeys(g, g->ephemeron, NULL); /* clear keys from all ephemeron tables */
1030 clearkeys(g, g->allweak, NULL); /* clear keys from all allweak tables */
1031 /* clear values from resurrected weak tables */
1032 clearvalues(g, g->weak, origweak);
1033 clearvalues(g, g->allweak, origall);
1034 g->currentwhite = cast_byte(otherwhite(g)); /* flip current white */
1035 work += g->GCmemtrav; /* complete counting */
1036 return work; /* estimate of memory marked by 'atomic' */
1037}
1038
1039
1040static lu_mem singlestep (lua_State *L) {

Callers 1

singlestepFunction · 0.70

Calls 9

retraversegraysFunction · 0.85
markmtFunction · 0.70
remarkupvalsFunction · 0.70
propagateallFunction · 0.70
convergeephemeronsFunction · 0.70
clearvaluesFunction · 0.70
separatetobefnzFunction · 0.70
markbeingfnzFunction · 0.70
clearkeysFunction · 0.70

Tested by

no test coverage detected