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
This commit is contained in:
Roberto Ierusalimschy
2017-05-26 16:14:29 -03:00
parent 4804bbd9bb
commit 72d82a296c
7 changed files with 209 additions and 199 deletions

20
lgc.h
View File

@@ -1,5 +1,5 @@
/*
** $Id: lgc.h,v 2.96 2017/04/11 18:41:09 roberto Exp roberto $
** $Id: lgc.h,v 2.97 2017/05/04 13:32:01 roberto Exp roberto $
** Garbage Collector
** See Copyright Notice in lua.h
*/
@@ -25,14 +25,6 @@
*/
/* how much to allocate before next GC step */
#if !defined(GCSTEPSIZE)
/* ~100 small strings */
#define GCSTEPSIZE (cast_int(100 * sizeof(TString)))
#endif
/*
** Possible states of the Garbage Collector
*/
@@ -125,6 +117,16 @@
check_exp(getage(o) == (f), (o)->marked ^= ((f)^(t)))
/* Default Values for GC parameters */
#define LUAI_GENMAJORMUL 100
#define LUAI_GENMINORMUL 5
#define LUAI_GCPAUSE 100 /* 100% */
#define LUAI_GCMUL 10
/* how much to allocate before next GC step (log2) */
#define LUAI_GCSTEPSIZE 13 /* 8 KB */
/*
** Does one step of collection when debt becomes positive. 'pre'/'pos'
** allows some adjustments to be done only when needed. macro