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

Function reallymarkobject

third-party/lua-5.5.0/src/lgc.c:339–372  ·  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

337** (only closures can), and a userdata's metatable must be a table.
338*/
339static void reallymarkobject (global_State *g, GCObject *o) {
340 g->GCmarked += objsize(o);
341 switch (o->tt) {
342 case LUA_VSHRSTR:
343 case LUA_VLNGSTR: {
344 set2black(o); /* nothing to visit */
345 break;
346 }
347 case LUA_VUPVAL: {
348 UpVal *uv = gco2upv(o);
349 if (upisopen(uv))
350 set2gray(uv); /* open upvalues are kept gray */
351 else
352 set2black(uv); /* closed upvalues are visited here */
353 markvalue(g, uv->v.p); /* mark its content */
354 break;
355 }
356 case LUA_VUSERDATA: {
357 Udata *u = gco2u(o);
358 if (u->nuvalue == 0) { /* no user values? */
359 markobjectN(g, u->metatable); /* mark its metatable */
360 set2black(u); /* nothing else to mark */
361 break;
362 }
363 /* else... */
364 } /* FALLTHROUGH */
365 case LUA_VLCL: case LUA_VCCL: case LUA_VTABLE:
366 case LUA_VTHREAD: case LUA_VPROTO: {
367 linkobjgclist(o, g->gray); /* to be visited later */
368 break;
369 }
370 default: lua_assert(0); break;
371 }
372}
373
374
375/*

Callers 4

luaC_barrier_Function · 0.70
traversearrayFunction · 0.70
traverseephemeronFunction · 0.70
markoldFunction · 0.70

Calls 1

objsizeFunction · 0.85

Tested by

no test coverage detected