diff options
| author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-01-28 11:45:45 -0300 |
|---|---|---|
| committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2025-01-28 11:45:45 -0300 |
| commit | 39a14ea7d7b14172595c61619e8f35c2614b2606 (patch) | |
| tree | 863ea56e6014de9e1284f2e47ac1fbd4b69339ed /lapi.c | |
| parent | c4e7cdb541d89142056927ebdfd8f97017d38f45 (diff) | |
| download | lua-39a14ea7d7b14172595c61619e8f35c2614b2606.tar.gz lua-39a14ea7d7b14172595c61619e8f35c2614b2606.tar.bz2 lua-39a14ea7d7b14172595c61619e8f35c2614b2606.zip | |
CallInfo bit CIST_CLSRET broken in two
Since commit f407b3c4a, it was being used for two distinct (and
incompatible) meanings:
A: Function has TBC variables (now bit CIST_TBC)
B: Interpreter is closing TBC variables (original bit CIST_CLSRET)
B implies A, but A does not imply B.
Diffstat (limited to 'lapi.c')
| -rw-r--r-- | lapi.c | 6 |
1 files changed, 3 insertions, 3 deletions
| @@ -195,7 +195,7 @@ LUA_API void lua_settop (lua_State *L, int idx) { | |||
| 195 | } | 195 | } |
| 196 | newtop = L->top.p + diff; | 196 | newtop = L->top.p + diff; |
| 197 | if (diff < 0 && L->tbclist.p >= newtop) { | 197 | if (diff < 0 && L->tbclist.p >= newtop) { |
| 198 | lua_assert(ci->callstatus & CIST_CLSRET); | 198 | lua_assert(ci->callstatus & CIST_TBC); |
| 199 | newtop = luaF_close(L, newtop, CLOSEKTOP, 0); | 199 | newtop = luaF_close(L, newtop, CLOSEKTOP, 0); |
| 200 | } | 200 | } |
| 201 | L->top.p = newtop; /* correct top only after closing any upvalue */ | 201 | L->top.p = newtop; /* correct top only after closing any upvalue */ |
| @@ -207,7 +207,7 @@ LUA_API void lua_closeslot (lua_State *L, int idx) { | |||
| 207 | StkId level; | 207 | StkId level; |
| 208 | lua_lock(L); | 208 | lua_lock(L); |
| 209 | level = index2stack(L, idx); | 209 | level = index2stack(L, idx); |
| 210 | api_check(L, (L->ci->callstatus & CIST_CLSRET) && L->tbclist.p == level, | 210 | api_check(L, (L->ci->callstatus & CIST_TBC) && (L->tbclist.p == level), |
| 211 | "no variable to close at given level"); | 211 | "no variable to close at given level"); |
| 212 | level = luaF_close(L, level, CLOSEKTOP, 0); | 212 | level = luaF_close(L, level, CLOSEKTOP, 0); |
| 213 | setnilvalue(s2v(level)); | 213 | setnilvalue(s2v(level)); |
| @@ -1280,7 +1280,7 @@ LUA_API void lua_toclose (lua_State *L, int idx) { | |||
| 1280 | o = index2stack(L, idx); | 1280 | o = index2stack(L, idx); |
| 1281 | api_check(L, L->tbclist.p < o, "given index below or equal a marked one"); | 1281 | api_check(L, L->tbclist.p < o, "given index below or equal a marked one"); |
| 1282 | luaF_newtbcupval(L, o); /* create new to-be-closed upvalue */ | 1282 | luaF_newtbcupval(L, o); /* create new to-be-closed upvalue */ |
| 1283 | L->ci->callstatus |= CIST_CLSRET; /* mark that function has TBC slots */ | 1283 | L->ci->callstatus |= CIST_TBC; /* mark that function has TBC slots */ |
| 1284 | lua_unlock(L); | 1284 | lua_unlock(L); |
| 1285 | } | 1285 | } |
| 1286 | 1286 | ||
