aboutsummaryrefslogtreecommitdiff
path: root/lstate.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-27 15:53:35 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2013-08-27 15:53:35 -0300
commitaf35c7f398e8149b5f2481b63b399674e4ecdf7e (patch)
tree7d74f5c81bb0e2555cab4bce00a94a12a6d78604 /lstate.h
parent742b7377d38e43224ee5dda4bb83a42763c20af8 (diff)
downloadlua-af35c7f398e8149b5f2481b63b399674e4ecdf7e.tar.gz
lua-af35c7f398e8149b5f2481b63b399674e4ecdf7e.tar.bz2
lua-af35c7f398e8149b5f2481b63b399674e4ecdf7e.zip
upvalues collected by reference count
Diffstat (limited to 'lstate.h')
-rw-r--r--lstate.h14
1 files changed, 2 insertions, 12 deletions
diff --git a/lstate.h b/lstate.h
index 02180df7..e0aed2d9 100644
--- a/lstate.h
+++ b/lstate.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lstate.h,v 2.89 2013/08/23 13:34:54 roberto Exp roberto $ 2** $Id: lstate.h,v 2.90 2013/08/26 12:41:10 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*/
@@ -27,13 +27,6 @@
27** List 'fixedgc' keep objects that are not to be collected (currently 27** List 'fixedgc' keep objects that are not to be collected (currently
28** only small strings, such as reserved words). 28** only small strings, such as reserved words).
29** 29**
30** Open upvalues are not subject to independent garbage collection. They
31** are collected together with their respective threads. (They are
32** always gray, so they must be remarked in the atomic step. Usually
33** their contents would be marked when traversing the respective
34** threads, but the thread may already be dead, while the upvalue is
35** still accessible through closures.)
36**
37** Live objects with finalizers are kept in the list g->finobj. The 30** Live objects with finalizers are kept in the list g->finobj. The
38** list g->tobefnz links all objects being finalized. In particular, an 31** list g->tobefnz links all objects being finalized. In particular, an
39** object has its FINALIZEDBIT set iff it is in one of these lists. 32** object has its FINALIZEDBIT set iff it is in one of these lists.
@@ -128,7 +121,6 @@ typedef struct global_State {
128 lu_byte gcrunning; /* true if GC is running */ 121 lu_byte gcrunning; /* true if GC is running */
129 GCObject *allgc; /* list of all collectable objects */ 122 GCObject *allgc; /* list of all collectable objects */
130 GCObject *localgc; /* list of local objects */ 123 GCObject *localgc; /* list of local objects */
131 GCObject *localupv; /* list of local upvalues */
132 GCObject *finobj; /* list of collectable objects with finalizers */ 124 GCObject *finobj; /* list of collectable objects with finalizers */
133 GCObject **sweepgc; /* current position of sweep in list 'allgc' */ 125 GCObject **sweepgc; /* current position of sweep in list 'allgc' */
134 GCObject **sweepfin; /* current position of sweep in list 'finobj' */ 126 GCObject **sweepfin; /* current position of sweep in list 'finobj' */
@@ -171,7 +163,7 @@ struct lua_State {
171 int basehookcount; 163 int basehookcount;
172 int hookcount; 164 int hookcount;
173 lua_Hook hook; 165 lua_Hook hook;
174 GCObject *openupval; /* list of open upvalues in this stack */ 166 UpVal *openupval; /* list of open upvalues in this stack */
175 GCObject *gclist; 167 GCObject *gclist;
176 struct lua_longjmp *errorJmp; /* current error recover point */ 168 struct lua_longjmp *errorJmp; /* current error recover point */
177 ptrdiff_t errfunc; /* current error handling function (stack index) */ 169 ptrdiff_t errfunc; /* current error handling function (stack index) */
@@ -192,7 +184,6 @@ union GCObject {
192 union Closure cl; 184 union Closure cl;
193 struct Table h; 185 struct Table h;
194 struct Proto p; 186 struct Proto p;
195 struct UpVal uv;
196 struct lua_State th; /* thread */ 187 struct lua_State th; /* thread */
197}; 188};
198 189
@@ -211,7 +202,6 @@ union GCObject {
211 check_exp(novariant((o)->gch.tt) == LUA_TFUNCTION, &((o)->cl)) 202 check_exp(novariant((o)->gch.tt) == LUA_TFUNCTION, &((o)->cl))
212#define gco2t(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h)) 203#define gco2t(o) check_exp((o)->gch.tt == LUA_TTABLE, &((o)->h))
213#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p)) 204#define gco2p(o) check_exp((o)->gch.tt == LUA_TPROTO, &((o)->p))
214#define gco2uv(o) check_exp((o)->gch.tt == LUA_TUPVAL, &((o)->uv))
215#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th)) 205#define gco2th(o) check_exp((o)->gch.tt == LUA_TTHREAD, &((o)->th))
216 206
217/* macro to convert any Lua object into a GCObject */ 207/* macro to convert any Lua object into a GCObject */