From be908a7d4d8130264ad67c5789169769f824c5d1 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Tue, 8 Nov 2022 10:15:10 -0300 Subject: Removed unused field 'UpVal.tbc' --- lfunc.c | 5 ++--- lobject.h | 1 - 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/lfunc.c b/lfunc.c index 804bf9dc..0945f241 100644 --- a/lfunc.c +++ b/lfunc.c @@ -62,12 +62,11 @@ void luaF_initupvals (lua_State *L, LClosure *cl) { ** Create a new upvalue at the given level, and link it to the list of ** open upvalues of 'L' after entry 'prev'. **/ -static UpVal *newupval (lua_State *L, int tbc, StkId level, UpVal **prev) { +static UpVal *newupval (lua_State *L, StkId level, UpVal **prev) { GCObject *o = luaC_newobj(L, LUA_VUPVAL, sizeof(UpVal)); UpVal *uv = gco2upv(o); UpVal *next = *prev; uv->v.p = s2v(level); /* current value lives in the stack */ - uv->tbc = tbc; uv->u.open.next = next; /* link it to list of open upvalues */ uv->u.open.previous = prev; if (next) @@ -96,7 +95,7 @@ UpVal *luaF_findupval (lua_State *L, StkId level) { pp = &p->u.open.next; } /* not found: create a new upvalue after 'pp' */ - return newupval(L, 0, level, pp); + return newupval(L, level, pp); } diff --git a/lobject.h b/lobject.h index e7f58cbd..556608e4 100644 --- a/lobject.h +++ b/lobject.h @@ -628,7 +628,6 @@ typedef struct Proto { */ typedef struct UpVal { CommonHeader; - lu_byte tbc; /* true if it represents a to-be-closed variable */ union { TValue *p; /* points to stack or to its own value */ ptrdiff_t offset; /* used while the stack is being reallocated */ -- cgit v1.2.3-55-g6feb From 9a77f57edc5cc24c2ab71d416b7481a5679e3869 Mon Sep 17 00:00:00 2001 From: Roberto Ierusalimschy Date: Wed, 23 Nov 2022 14:17:28 -0300 Subject: Stop GC while building initial state --- lua.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/lua.c b/lua.c index 7f7dc2b2..715430a0 100644 --- a/lua.c +++ b/lua.c @@ -633,7 +633,8 @@ static int pmain (lua_State *L) { } luaL_openlibs(L); /* open standard libraries */ createargtable(L, argv, argc, script); /* create table 'arg' */ - lua_gc(L, LUA_GCGEN, 0, 0); /* GC in generational mode */ + lua_gc(L, LUA_GCRESTART); /* start GC... */ + lua_gc(L, LUA_GCGEN, 0, 0); /* ...in generational mode */ if (!(args & has_E)) { /* no option '-E'? */ if (handle_luainit(L) != LUA_OK) /* run LUA_INIT */ return 0; /* error running LUA_INIT */ @@ -665,6 +666,7 @@ int main (int argc, char **argv) { l_message(argv[0], "cannot create state: not enough memory"); return EXIT_FAILURE; } + lua_gc(L, LUA_GCSTOP); /* stop GC while buidling state */ lua_pushcfunction(L, &pmain); /* to call 'pmain' in protected mode */ lua_pushinteger(L, argc); /* 1st argument */ lua_pushlightuserdata(L, argv); /* 2nd argument */ -- cgit v1.2.3-55-g6feb