aboutsummaryrefslogtreecommitdiff
path: root/lgc.h
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 /lgc.h
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 'lgc.h')
-rw-r--r--lgc.h20
1 files changed, 11 insertions, 9 deletions
diff --git a/lgc.h b/lgc.h
index 6ee0b012..36f361ec 100644
--- a/lgc.h
+++ b/lgc.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lgc.h,v 2.96 2017/04/11 18:41:09 roberto Exp roberto $ 2** $Id: lgc.h,v 2.97 2017/05/04 13:32:01 roberto Exp roberto $
3** Garbage Collector 3** Garbage Collector
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -25,14 +25,6 @@
25*/ 25*/
26 26
27 27
28
29/* how much to allocate before next GC step */
30#if !defined(GCSTEPSIZE)
31/* ~100 small strings */
32#define GCSTEPSIZE (cast_int(100 * sizeof(TString)))
33#endif
34
35
36/* 28/*
37** Possible states of the Garbage Collector 29** Possible states of the Garbage Collector
38*/ 30*/
@@ -125,6 +117,16 @@
125 check_exp(getage(o) == (f), (o)->marked ^= ((f)^(t))) 117 check_exp(getage(o) == (f), (o)->marked ^= ((f)^(t)))
126 118
127 119
120/* Default Values for GC parameters */
121#define LUAI_GENMAJORMUL 100
122#define LUAI_GENMINORMUL 5
123
124#define LUAI_GCPAUSE 100 /* 100% */
125#define LUAI_GCMUL 10
126/* how much to allocate before next GC step (log2) */
127#define LUAI_GCSTEPSIZE 13 /* 8 KB */
128
129
128/* 130/*
129** Does one step of collection when debt becomes positive. 'pre'/'pos' 131** Does one step of collection when debt becomes positive. 'pre'/'pos'
130** allows some adjustments to be done only when needed. macro 132** allows some adjustments to be done only when needed. macro