diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-18 09:08:10 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2018-06-18 09:08:10 -0300 |
commit | af70905246acfad225904b64d027e5b01c7b10eb (patch) | |
tree | b6d62db411706f5317e1269aff90e05399cd51b8 /lstate.c | |
parent | b95e46621873cfb460e1d11dcd153914d5d69f86 (diff) | |
download | lua-af70905246acfad225904b64d027e5b01c7b10eb.tar.gz lua-af70905246acfad225904b64d027e5b01c7b10eb.tar.bz2 lua-af70905246acfad225904b64d027e5b01c7b10eb.zip |
no need to check whether libraries and host use the same kernel;
Lua should work correctly with several copies of the kernel
Diffstat (limited to '')
-rw-r--r-- | lstate.c | 11 |
1 files changed, 5 insertions, 6 deletions
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | ** $Id: lstate.c,v 2.153 2018/06/01 17:40:38 roberto Exp roberto $ | 2 | ** $Id: lstate.c,v 2.154 2018/06/15 19:31:22 roberto Exp roberto $ |
3 | ** Global State | 3 | ** Global State |
4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
5 | */ | 5 | */ |
@@ -215,7 +215,7 @@ static void init_registry (lua_State *L, global_State *g) { | |||
215 | 215 | ||
216 | /* | 216 | /* |
217 | ** open parts of the state that may cause memory-allocation errors. | 217 | ** open parts of the state that may cause memory-allocation errors. |
218 | ** ('g->version' != NULL flags that the state was completely build) | 218 | ** ('ttisnil(&g->nilvalue)'' flags that the state was completely build) |
219 | */ | 219 | */ |
220 | static void f_luaopen (lua_State *L, void *ud) { | 220 | static void f_luaopen (lua_State *L, void *ud) { |
221 | global_State *g = G(L); | 221 | global_State *g = G(L); |
@@ -226,7 +226,7 @@ static void f_luaopen (lua_State *L, void *ud) { | |||
226 | luaT_init(L); | 226 | luaT_init(L); |
227 | luaX_init(L); | 227 | luaX_init(L); |
228 | g->gcrunning = 1; /* allow gc */ | 228 | g->gcrunning = 1; /* allow gc */ |
229 | g->version = lua_version(NULL); | 229 | setnilvalue(&g->nilvalue); |
230 | luai_userstateopen(L); | 230 | luai_userstateopen(L); |
231 | } | 231 | } |
232 | 232 | ||
@@ -260,7 +260,7 @@ static void close_state (lua_State *L) { | |||
260 | global_State *g = G(L); | 260 | global_State *g = G(L); |
261 | luaF_close(L, L->stack); /* close all upvalues for this thread */ | 261 | luaF_close(L, L->stack); /* close all upvalues for this thread */ |
262 | luaC_freeallobjects(L); /* collect all objects */ | 262 | luaC_freeallobjects(L); /* collect all objects */ |
263 | if (g->version) /* closing a fully built state? */ | 263 | if (ttisnil(&g->nilvalue)) /* closing a fully built state? */ |
264 | luai_userstateclose(L); | 264 | luai_userstateclose(L); |
265 | luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); | 265 | luaM_freearray(L, G(L)->strt.hash, G(L)->strt.size); |
266 | freestack(L); | 266 | freestack(L); |
@@ -332,7 +332,6 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
332 | g->strt.hash = NULL; | 332 | g->strt.hash = NULL; |
333 | setnilvalue(&g->l_registry); | 333 | setnilvalue(&g->l_registry); |
334 | g->panic = NULL; | 334 | g->panic = NULL; |
335 | g->version = NULL; | ||
336 | g->gcstate = GCSpause; | 335 | g->gcstate = GCSpause; |
337 | g->gckind = KGC_INC; | 336 | g->gckind = KGC_INC; |
338 | g->gcemergency = 0; | 337 | g->gcemergency = 0; |
@@ -345,7 +344,7 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) { | |||
345 | g->twups = NULL; | 344 | g->twups = NULL; |
346 | g->totalbytes = sizeof(LG); | 345 | g->totalbytes = sizeof(LG); |
347 | g->GCdebt = 0; | 346 | g->GCdebt = 0; |
348 | setnilvalue(&g->nilvalue); | 347 | setivalue(&g->nilvalue, 0); /* to signal that state is not yet built */ |
349 | setgcparam(g->gcpause, LUAI_GCPAUSE); | 348 | setgcparam(g->gcpause, LUAI_GCPAUSE); |
350 | setgcparam(g->gcstepmul, LUAI_GCMUL); | 349 | setgcparam(g->gcstepmul, LUAI_GCMUL); |
351 | g->gcstepsize = LUAI_GCSTEPSIZE; | 350 | g->gcstepsize = LUAI_GCSTEPSIZE; |