diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-08-16 15:55:49 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2013-08-16 15:55:49 -0300 |
| commit | 439d74e29f3234a034777f88b260523afe8c0446 (patch) | |
| tree | a3ee160dccfd3cf0f065edbba07290c4ba9af93d /lapi.c | |
| parent | 3679d33b02782ff7d7d0fa163b815902b189c89e (diff) | |
| download | lua-439d74e29f3234a034777f88b260523afe8c0446.tar.gz lua-439d74e29f3234a034777f88b260523afe8c0446.tar.bz2 lua-439d74e29f3234a034777f88b260523afe8c0446.zip | |
added 'local' bit (true => object is only refered by local variables)
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 8 |
1 files changed, 6 insertions, 2 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* |
| 2 | ** $Id: lapi.c,v 2.185 2013/07/05 14:29:51 roberto Exp roberto $ | 2 | ** $Id: lapi.c,v 2.186 2013/08/05 16:58:28 roberto Exp roberto $ |
| 3 | ** Lua API | 3 | ** Lua API |
| 4 | ** See Copyright Notice in lua.h | 4 | ** See Copyright Notice in lua.h |
| 5 | */ | 5 | */ |
| @@ -586,8 +586,11 @@ LUA_API void lua_pushcclosure (lua_State *L, lua_CFunction fn, int n) { | |||
| 586 | cl = luaF_newCclosure(L, n); | 586 | cl = luaF_newCclosure(L, n); |
| 587 | cl->c.f = fn; | 587 | cl->c.f = fn; |
| 588 | L->top -= n; | 588 | L->top -= n; |
| 589 | while (n--) | 589 | while (n--) { |
| 590 | setobj2n(L, &cl->c.upvalue[n], L->top + n); | 590 | setobj2n(L, &cl->c.upvalue[n], L->top + n); |
| 591 | /* does not need barrier because closure is white */ | ||
| 592 | valnolocal(L->top + n); /* but needs 'local barrier' */ | ||
| 593 | } | ||
| 591 | setclCvalue(L, L->top, cl); | 594 | setclCvalue(L, L->top, cl); |
| 592 | } | 595 | } |
| 593 | api_incr_top(L); | 596 | api_incr_top(L); |
| @@ -861,6 +864,7 @@ LUA_API int lua_setmetatable (lua_State *L, int objindex) { | |||
| 861 | } | 864 | } |
| 862 | default: { | 865 | default: { |
| 863 | G(L)->mt[ttnov(obj)] = mt; | 866 | G(L)->mt[ttnov(obj)] = mt; |
| 867 | if (mt) nolocal(obj2gco(mt)); | ||
| 864 | break; | 868 | break; |
| 865 | } | 869 | } |
| 866 | } | 870 | } |
