diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-04-11 15:41:09 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2017-04-11 15:41:09 -0300 |
| commit | a3d36fe283c09d4e56474da98f22d13162cc9fec (patch) | |
| tree | 1f6e2ed56d50dc14aa669fa5f31a63755abd4553 /lfunc.h | |
| parent | 9569ad6b0ddcde43eb893d2cfe5bcdb715c0ff20 (diff) | |
| download | lua-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.h | 18 |
1 files changed, 2 insertions, 16 deletions
| @@ -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 | */ | ||
| 35 | struct 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); | |||
| 53 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); | 38 | LUAI_FUNC void luaF_initupvals (lua_State *L, LClosure *cl); |
| 54 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); | 39 | LUAI_FUNC UpVal *luaF_findupval (lua_State *L, StkId level); |
| 55 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); | 40 | LUAI_FUNC void luaF_close (lua_State *L, StkId level); |
| 41 | LUAI_FUNC void luaF_unlinkupval (UpVal *uv); | ||
| 56 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); | 42 | LUAI_FUNC void luaF_freeproto (lua_State *L, Proto *f); |
| 57 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, | 43 | LUAI_FUNC const char *luaF_getlocalname (const Proto *func, int local_number, |
| 58 | int pc); | 44 | int pc); |
