diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-02-09 14:00:05 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2021-02-09 14:00:05 -0300 |
commit | 4e47f81188d37e29027158b76271d02a781242e2 (patch) | |
tree | c360912d1901acf8371390cc1f716278e5d91bb4 /lvm.c | |
parent | c63e5d212bc5dec1b1c749e3f07b42cd83081826 (diff) | |
download | lua-4e47f81188d37e29027158b76271d02a781242e2.tar.gz lua-4e47f81188d37e29027158b76271d02a781242e2.tar.bz2 lua-4e47f81188d37e29027158b76271d02a781242e2.zip |
New implementation for to-be-closed variables
To-be-closed variables are linked in their own list, embedded into the
stack elements. (Due to alignment, this information does not change
the size of the stack elements in most architectures.) This new list
does not produce garbage and avoids memory errors when creating tbc
variables.
Diffstat (limited to 'lvm.c')
-rw-r--r-- | lvm.c | 6 |
1 files changed, 2 insertions, 4 deletions
@@ -1635,10 +1635,8 @@ void luaV_execute (lua_State *L, CallInfo *ci) { | |||
1635 | b = cast_int(L->top - ra); | 1635 | b = cast_int(L->top - ra); |
1636 | savepc(ci); /* several calls here can raise errors */ | 1636 | savepc(ci); /* several calls here can raise errors */ |
1637 | if (TESTARG_k(i)) { | 1637 | if (TESTARG_k(i)) { |
1638 | /* close upvalues from current call; the compiler ensures | 1638 | luaF_closeupval(L, base); /* close upvalues from current call */ |
1639 | that there are no to-be-closed variables here, so this | 1639 | lua_assert(L->tbclist < base); /* no pending tbc variables */ |
1640 | call cannot change the stack */ | ||
1641 | luaF_close(L, base, NOCLOSINGMETH, 0); | ||
1642 | lua_assert(base == ci->func + 1); | 1640 | lua_assert(base == ci->func + 1); |
1643 | } | 1641 | } |
1644 | while (!ttisfunction(s2v(ra))) { /* not a function? */ | 1642 | while (!ttisfunction(s2v(ra))) { /* not a function? */ |