| 443 | |
| 444 | |
| 445 | static void GCTM (lua_State *L) { |
| 446 | global_State *g = G(L); |
| 447 | GCObject *o = g->tmudata->gch.next; /* get first element */ |
| 448 | Udata *udata = rawgco2u(o); |
| 449 | const TValue *tm; |
| 450 | /* remove udata from `tmudata' */ |
| 451 | if (o == g->tmudata) /* last element? */ |
| 452 | g->tmudata = NULL; |
| 453 | else |
| 454 | g->tmudata->gch.next = udata->uv.next; |
| 455 | udata->uv.next = g->mainthread->next; /* return it to `root' list */ |
| 456 | g->mainthread->next = o; |
| 457 | makewhite(g, o); |
| 458 | tm = fasttm(L, udata->uv.metatable, TM_GC); |
| 459 | if (tm != NULL) { |
| 460 | lu_byte oldah = L->allowhook; |
| 461 | lu_mem oldt = g->GCthreshold; |
| 462 | L->allowhook = 0; /* stop debug hooks during GC tag method */ |
| 463 | g->GCthreshold = 2*g->totalbytes; /* avoid GC steps */ |
| 464 | setobj2s(L, L->top, tm); |
| 465 | setuvalue(L, L->top+1, udata); |
| 466 | L->top += 2; |
| 467 | luaD_call(L, L->top - 2, 0); |
| 468 | L->allowhook = oldah; /* restore hooks */ |
| 469 | g->GCthreshold = oldt; /* restore threshold */ |
| 470 | } |
| 471 | } |
| 472 | |
| 473 | |
| 474 | /* |
no test coverage detected