diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-22 09:41:10 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-07-22 09:41:10 -0300 |
commit | 9e6807c3c9d5036e999f636f936df07b72284442 (patch) | |
tree | 39100fb44792114905f00d1b638212f620d12a25 /lvm.c | |
parent | 2f22c6bb79d209a55b3fc8e0b2d9c9f89f038174 (diff) | |
download | lua-9e6807c3c9d5036e999f636f936df07b72284442.tar.gz lua-9e6807c3c9d5036e999f636f936df07b72284442.tar.bz2 lua-9e6807c3c9d5036e999f636f936df07b72284442.zip |
Do not collect open upvalues
Open upvalues are kept alive together with their corresponding
stack. This change makes a simpler and safer fix to the issue in
commit 440a5ee78c8, about upvalues in the list of open upvalues
being collected while others are being created. (That previous fix
may not be correct.)
Diffstat (limited to '')
-rw-r--r-- | lvm.c | 2 |
1 files changed, 1 insertions, 1 deletions
@@ -697,7 +697,7 @@ static void pushclosure (lua_State *L, Proto *p, UpVal **encup, StkId base, | |||
697 | setclLvalue2s(L, ra, ncl); /* anchor new closure in stack */ | 697 | setclLvalue2s(L, ra, ncl); /* anchor new closure in stack */ |
698 | for (i = 0; i < nup; i++) { /* fill in its upvalues */ | 698 | for (i = 0; i < nup; i++) { /* fill in its upvalues */ |
699 | if (uv[i].instack) /* upvalue refers to local variable? */ | 699 | if (uv[i].instack) /* upvalue refers to local variable? */ |
700 | luaF_setupval(L, base + uv[i].idx, &ncl->upvals[i]); | 700 | ncl->upvals[i] = luaF_findupval(L, base + uv[i].idx); |
701 | else /* get upvalue from enclosing function */ | 701 | else /* get upvalue from enclosing function */ |
702 | ncl->upvals[i] = encup[uv[i].idx]; | 702 | ncl->upvals[i] = encup[uv[i].idx]; |
703 | luaC_objbarrier(L, ncl, ncl->upvals[i]); | 703 | luaC_objbarrier(L, ncl, ncl->upvals[i]); |