aboutsummaryrefslogtreecommitdiff
path: root/lfunc.h
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-04-11 15:41:09 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2017-04-11 15:41:09 -0300
commita3d36fe283c09d4e56474da98f22d13162cc9fec (patch)
tree1f6e2ed56d50dc14aa669fa5f31a63755abd4553 /lfunc.h
parent9569ad6b0ddcde43eb893d2cfe5bcdb715c0ff20 (diff)
downloadlua-a3d36fe283c09d4e56474da98f22d13162cc9fec.tar.gz
lua-a3d36fe283c09d4e56474da98f22d13162cc9fec.tar.bz2
lua-a3d36fe283c09d4e56474da98f22d13162cc9fec.zip
Upvalues collected like everything else (with mark-sweep) instead
of reference count (simpler and better for generational mode)
Diffstat (limited to 'lfunc.h')
-rw-r--r--lfunc.h18
1 files changed, 2 insertions, 16 deletions
diff --git a/lfunc.h b/lfunc.h
index 6fd3fbac..7d0eca4a 100644
--- a/lfunc.h
+++ b/lfunc.h
@@ -1,5 +1,5 @@
1/* 1/*
2** $Id: lfunc.h,v 2.14 2014/06/19 18:27:20 roberto Exp roberto $ 2** $Id: lfunc.h,v 2.15 2015/01/13 15:49:11 roberto Exp roberto $
3** Auxiliary functions to manipulate prototypes and closures 3** Auxiliary functions to manipulate prototypes and closures
4** See Copyright Notice in lua.h 4** See Copyright Notice in lua.h
5*/ 5*/
@@ -29,21 +29,6 @@
29#define MAXUPVAL 255 29#define MAXUPVAL 255
30 30
31 31
32/*
33** Upvalues for Lua closures
34*/
35struct UpVal {
36 TValue *v; /* points to stack or to its own value */
37 lu_mem refcount; /* reference counter */
38 union {
39 struct { /* (when open) */
40 UpVal *next; /* linked list */
41 int touched; /* mark to avoid cycles with dead threads */
42 } open;
43 TValue value; /* the value (when closed) */
44 } u;
45};
46
47#define upisopen(up) ((up)->v != &(up)->u.value) 32#define upisopen(up) ((up)->v != &(up)->u.value)
48 33
49 34
@@ -53,6 +38,7 @@ LUAI_FUNC LClosure *luaF_newLclosure (lua_State *L, int nelems);
53LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); 38LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl);
54LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); 39LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level);
55LUAI_FUNC void luaF_close (lua_State *L, StkId level); 40LUAI_FUNC void luaF_close (lua_State *L, StkId level);
41LUAI_FUNC void luaF_unlinkupval (UpVal *uv);
56LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); 42LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f);
57LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, 43LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number,
58 int pc); 44 int pc);