diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-08-27 17:04:00 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-08-27 17:04:00 -0300 |
| commit | 90972ff136f310f00b04d9e9837ee0640983b743 (patch) | |
| tree | 5362eb13fd6ab3d314bc9baefe3d73b1f0e02fad /lfunc.c | |
| parent | af35c7f398e8149b5f2481b63b399674e4ecdf7e (diff) | |
| download | lua-90972ff136f310f00b04d9e9837ee0640983b743.tar.gz lua-90972ff136f310f00b04d9e9837ee0640983b743.tar.bz2 lua-90972ff136f310f00b04d9e9837ee0640983b743.zip | |
LOCALBLACK changed to LOCALMARK and used also to control whether object
is in 'localgc' list + luaC_newobj by default puts object in 'localgc'
list
Diffstat (limited to 'lfunc.c')
| -rw-r--r-- | lfunc.c | 10 |
1 files changed, 4 insertions, 6 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lfunc.c,v 2.35 2013/08/26 12:41:10 roberto Exp roberto $ | 2 | ** $Id: lfunc.c,v 2.36 2013/08/27 18:53:35 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 | */ |
| @@ -21,16 +21,14 @@ | |||
| 21 | 21 | ||
| 22 | 22 | ||
| 23 | Closure *luaF_newCclosure (lua_State *L, int n) { | 23 | Closure *luaF_newCclosure (lua_State *L, int n) { |
| 24 | Closure *c = &luaC_newobj(L, LUA_TCCL, sizeCclosure(n), | 24 | Closure *c = &luaC_newobj(L, LUA_TCCL, sizeCclosure(n), NULL, 0)->cl; |
| 25 | &G(L)->localgc, 0)->cl; | ||
| 26 | c->c.nupvalues = cast_byte(n); | 25 | c->c.nupvalues = cast_byte(n); |
| 27 | return c; | 26 | return c; |
| 28 | } | 27 | } |
| 29 | 28 | ||
| 30 | 29 | ||
| 31 | Closure *luaF_newLclosure (lua_State *L, int n) { | 30 | Closure *luaF_newLclosure (lua_State *L, int n) { |
| 32 | Closure *c = &luaC_newobj(L, LUA_TLCL, sizeLclosure(n), | 31 | Closure *c = &luaC_newobj(L, LUA_TLCL, sizeLclosure(n), NULL, 0)->cl; |
| 33 | &G(L)->localgc, 0)->cl; | ||
| 34 | c->l.p = NULL; | 32 | c->l.p = NULL; |
| 35 | c->l.nupvalues = cast_byte(n); | 33 | c->l.nupvalues = cast_byte(n); |
| 36 | while (n--) c->l.upvals[n] = NULL; | 34 | while (n--) c->l.upvals[n] = NULL; |
| @@ -87,7 +85,7 @@ void luaF_close (lua_State *L, StkId level) { | |||
| 87 | 85 | ||
| 88 | 86 | ||
| 89 | Proto *luaF_newproto (lua_State *L) { | 87 | Proto *luaF_newproto (lua_State *L) { |
| 90 | Proto *f = &luaC_newobj(L, LUA_TPROTO, sizeof(Proto), NULL, 0)->p; | 88 | Proto *f = &luaC_newobj(L, LUA_TPROTO, sizeof(Proto), &G(L)->allgc, 0)->p; |
| 91 | nolocal(obj2gco(f)); /* prototypes are never local */ | 89 | nolocal(obj2gco(f)); /* prototypes are never local */ |
| 92 | f->k = NULL; | 90 | f->k = NULL; |
| 93 | f->sizek = 0; | 91 | f->sizek = 0; |
