aboutsummaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-03-24 10:07:01 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2010-03-24 10:07:01 -0300
commit4433dbb5f5ac0bb6118bc49ddf061f194c070814 (patch)
tree628f9da77c0cf6a80556a9c189f2528a3d7d7ca4 /lstate.h
parent5cb128ea540b33dbc6be659d5dfc3c64c57d78d9 (diff)
downloadlua-4433dbb5f5ac0bb6118bc49ddf061f194c070814.tar.gz
lua-4433dbb5f5ac0bb6118bc49ddf061f194c070814.tar.bz2
lua-4433dbb5f5ac0bb6118bc49ddf061f194c070814.zip
userdata with finalizers are kept in a separated list ('udgc'), instead
of at the end of 'rootgc' (which was renamed to 'allgc', as it is not "root" in the usual meaning for collectors)
Diffstat (limited to 'lstate.h')
-rw-r--r--lstate.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/lstate.h b/lstate.h
index ebf4e4af..45eccf8a 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 2.54 2010/03/13 15:55:42 roberto Exp roberto $ 2** $Id: lstate.h,v 2.55 2010/03/22 18:28:03 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*/
@@ -19,7 +19,7 @@
19** Some notes about garbage-collected objects: All objects in Lua must 19** Some notes about garbage-collected objects: All objects in Lua must
20** be kept somehow accessible until being freed. 20** be kept somehow accessible until being freed.
21** 21**
22** Lua keeps most objects linked in list g->rootgc. The link uses field 22** Lua keeps most objects linked in list g->allgc. The link uses field
23** 'next' of the CommonHeader. 23** 'next' of the CommonHeader.
24** 24**
25** Strings are kept in several lists headed by the array g->strt.hash. 25** Strings are kept in several lists headed by the array g->strt.hash.
@@ -32,9 +32,7 @@
32** when traversing the respective threads, but the thread may already be 32** when traversing the respective threads, but the thread may already be
33** dead, while the upvalue is still accessible through closures.) 33** dead, while the upvalue is still accessible through closures.)
34** 34**
35** Userdata with finalizers are kept in the list g->rootgc, but after 35** Userdata with finalizers are kept in the list g->udgc.
36** the mainthread, which should be otherwise the last element in the
37** list, as it was the first one inserted there.
38** 36**
39** The list g->tobefnz links all userdata being finalized. 37** The list g->tobefnz links all userdata being finalized.
40 38
@@ -124,7 +122,8 @@ typedef struct global_State {
124 lu_byte gcstate; /* state of garbage collector */ 122 lu_byte gcstate; /* state of garbage collector */
125 lu_byte gckind; /* kind of GC running */ 123 lu_byte gckind; /* kind of GC running */
126 int sweepstrgc; /* position of sweep in `strt' */ 124 int sweepstrgc; /* position of sweep in `strt' */
127 GCObject *rootgc; /* list of all collectable objects */ 125 GCObject *allgc; /* list of all collectable objects */
126 GCObject *udgc; /* list of collectable userdata with finalizers */
128 GCObject **sweepgc; /* current position of sweep */ 127 GCObject **sweepgc; /* current position of sweep */
129 GCObject *gray; /* list of gray objects */ 128 GCObject *gray; /* list of gray objects */
130 GCObject *grayagain; /* list of objects to be traversed atomically */ 129 GCObject *grayagain; /* list of objects to be traversed atomically */