Lines Matching refs:g
68 global_State g; member
102 void luaE_setdebt (global_State *g, l_mem debt) { in luaE_setdebt() argument
103 g->totalbytes -= (debt - g->GCdebt); in luaE_setdebt()
104 g->GCdebt = debt; in luaE_setdebt()
161 static void init_registry (lua_State *L, global_State *g) { in init_registry() argument
165 sethvalue(L, &g->l_registry, registry); in init_registry()
180 global_State *g = G(L); in f_luaopen() local
183 init_registry(L, g); in f_luaopen()
188 g->memerrmsg = luaS_newliteral(L, MEMERRMSG); in f_luaopen()
189 luaS_fix(g->memerrmsg); /* it should never be collected */ in f_luaopen()
190 g->gcrunning = 1; /* allow gc */ in f_luaopen()
191 g->version = lua_version(NULL); in f_luaopen()
200 static void preinit_state (lua_State *L, global_State *g) { in preinit_state() argument
201 G(L) = g; in preinit_state()
221 global_State *g = G(L); in close_state() local
224 if (g->version) /* closing a fully built state? */ in close_state()
227 luaZ_freebuffer(L, &g->buff); in close_state()
229 lua_assert(gettotalbytes(g) == sizeof(LG)); in close_state()
230 (*g->frealloc)(g->ud, fromstate(L), sizeof(LG), 0); /* free main block */ in close_state()
266 global_State *g; in lua_newstate() local
270 g = &l->g; in lua_newstate()
273 g->currentwhite = bit2mask(WHITE0BIT, FIXEDBIT); in lua_newstate()
274 L->marked = luaC_white(g); in lua_newstate()
275 g->gckind = KGC_NORMAL; in lua_newstate()
276 preinit_state(L, g); in lua_newstate()
277 g->frealloc = f; in lua_newstate()
278 g->ud = ud; in lua_newstate()
279 g->mainthread = L; in lua_newstate()
280 g->seed = makeseed(L); in lua_newstate()
281 g->uvhead.u.l.prev = &g->uvhead; in lua_newstate()
282 g->uvhead.u.l.next = &g->uvhead; in lua_newstate()
283 g->gcrunning = 0; /* no GC while building state */ in lua_newstate()
284 g->GCestimate = 0; in lua_newstate()
285 g->strt.size = 0; in lua_newstate()
286 g->strt.nuse = 0; in lua_newstate()
287 g->strt.hash = NULL; in lua_newstate()
288 setnilvalue(&g->l_registry); in lua_newstate()
289 luaZ_initbuffer(L, &g->buff); in lua_newstate()
290 g->panic = NULL; in lua_newstate()
291 g->version = NULL; in lua_newstate()
292 g->gcstate = GCSpause; in lua_newstate()
293 g->allgc = NULL; in lua_newstate()
294 g->finobj = NULL; in lua_newstate()
295 g->tobefnz = NULL; in lua_newstate()
296 g->sweepgc = g->sweepfin = NULL; in lua_newstate()
297 g->gray = g->grayagain = NULL; in lua_newstate()
298 g->weak = g->ephemeron = g->allweak = NULL; in lua_newstate()
299 g->totalbytes = sizeof(LG); in lua_newstate()
300 g->GCdebt = 0; in lua_newstate()
301 g->gcpause = LUAI_GCPAUSE; in lua_newstate()
302 g->gcmajorinc = LUAI_GCMAJOR; in lua_newstate()
303 g->gcstepmul = LUAI_GCMUL; in lua_newstate()
304 for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; in lua_newstate()