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

Function reallymarkobject

third-party/lua-5.4.6/src/lgc.c:297–329  ·  view source on GitHub ↗

** Mark an object. Userdata with no user values, strings, and closed ** upvalues are visited and turned black here. Open upvalues are ** already indirectly linked through their respective threads in the ** 'twups' list, so they don't go to the gray list; nevertheless, they ** are kept gray to avoid barriers, as their values will be revisited ** by the thread or by 'remarkupvals'. Other objects

Source from the content-addressed store, hash-verified

295** (only closures can), and a userdata's metatable must be a table.
296*/
297static void reallymarkobject (global_State *g, GCObject *o) {
298 switch (o->tt) {
299 case LUA_VSHRSTR:
300 case LUA_VLNGSTR: {
301 set2black(o); /* nothing to visit */
302 break;
303 }
304 case LUA_VUPVAL: {
305 UpVal *uv = gco2upv(o);
306 if (upisopen(uv))
307 set2gray(uv); /* open upvalues are kept gray */
308 else
309 set2black(uv); /* closed upvalues are visited here */
310 markvalue(g, uv->v.p); /* mark its content */
311 break;
312 }
313 case LUA_VUSERDATA: {
314 Udata *u = gco2u(o);
315 if (u->nuvalue == 0) { /* no user values? */
316 markobjectN(g, u->metatable); /* mark its metatable */
317 set2black(u); /* nothing else to mark */
318 break;
319 }
320 /* else... */
321 } /* FALLTHROUGH */
322 case LUA_VLCL: case LUA_VCCL: case LUA_VTABLE:
323 case LUA_VTHREAD: case LUA_VPROTO: {
324 linkobjgclist(o, g->gray); /* to be visited later */
325 break;
326 }
327 default: lua_assert(0); break;
328 }
329}
330
331
332/*

Callers 3

luaC_barrier_Function · 0.70
traverseephemeronFunction · 0.70
markoldFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected