static void freestack (lua_State *L) { if (L->stack == NULL) return; /* stack not completely built yet */ L->ci = &L->base_ci; /* free the entire 'ci' list */ luaE_freeCI(L); luaM_freearray(L, L->stack, L->stacksize); /* free stack array */ }
/* ** sweep the (open) upvalues of a thread and resize its stack and ** list of call-info structures. */ static void sweepthread (lua_State *L, lua_State *L1) { if (L1->stack == NULL) return; /* stack not completely built yet */ sweepwholelist(L, &L1->openupval); /* sweep open upvalues */ luaE_freeCI(L1); /* free extra CallInfo slots */ /* should not change the stack during an emergency gc cycle */ if (G(L)->gckind != KGC_EMERGENCY) luaD_shrinkstack(L1); }