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