summaryrefslogtreecommitdiff
path: root/lstate.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-05-26 16:14:29 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-05-26 16:14:29 -0300
commit72d82a296c1430a1d2bb3fac8ed8cbfb97868707 (patch)
tree4ea80148c5f1bfd38f0e7ca1cb8ef82e00e7e19c /lstate.c
parent4804bbd9bbfb89deb8a6c7dc2bc65601a701222b (diff)
downloadlua-72d82a296c1430a1d2bb3fac8ed8cbfb97868707.tar.gz
lua-72d82a296c1430a1d2bb3fac8ed8cbfb97868707.tar.bz2
lua-72d82a296c1430a1d2bb3fac8ed8cbfb97868707.zip
revamping the incremental collector
Some simplifications (not counting bytes, couting only slots visited; no more 'gcfinnum'); more GC parameters; using vararg in 'lua_gc' to set parameters in different GC modes
Diffstat (limited to 'lstate.c')
-rw-r--r--lstate.c12
1 files changed, 2 insertions, 10 deletions
diff --git a/lstate.c b/lstate.c
index 3bce076d..5f1c6e48 100644
--- a/lstate.c
+++ b/lstate.c
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.c,v 2.138 2017/04/24 16:59:26 roberto Exp roberto $ 2** $Id: lstate.c,v 2.139 2017/05/04 13:32:01 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*/
@@ -28,14 +28,6 @@
28#include "ltm.h" 28#include "ltm.h"
29 29
30 30
31#if !defined(LUAI_GCPAUSE)
32#define LUAI_GCPAUSE 200 /* 200% */
33#endif
34
35#if !defined(LUAI_GCMUL)
36#define LUAI_GCMUL 200 /* GC runs 'twice the speed' of memory allocation */
37#endif
38
39 31
40/* 32/*
41** a macro to help the creation of a unique random seed when a state is 33** a macro to help the creation of a unique random seed when a state is
@@ -328,9 +320,9 @@ LUA_API lua_State *lua_newstate (lua_Alloc f, void *ud) {
328 g->twups = NULL; 320 g->twups = NULL;
329 g->totalbytes = sizeof(LG); 321 g->totalbytes = sizeof(LG);
330 g->GCdebt = 0; 322 g->GCdebt = 0;
331 g->gcfinnum = 0;
332 g->gcpause = LUAI_GCPAUSE; 323 g->gcpause = LUAI_GCPAUSE;
333 g->gcstepmul = LUAI_GCMUL; 324 g->gcstepmul = LUAI_GCMUL;
325 g->gcstepsize = LUAI_GCSTEPSIZE;
334 for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL; 326 for (i=0; i < LUA_NUMTAGS; i++) g->mt[i] = NULL;
335 if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) { 327 if (luaD_rawrunprotected(L, f_luaopen, NULL) != LUA_OK) {
336 /* memory allocation error: free partial state */ 328 /* memory allocation error: free partial state */