aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-07-22 09:41:10 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2019-07-22 09:41:10 -0300
commit9e6807c3c9d5036e999f636f936df07b72284442 (patch)
tree39100fb44792114905f00d1b638212f620d12a25 /lgc.c
parent2f22c6bb79d209a55b3fc8e0b2d9c9f89f038174 (diff)
downloadlua-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 'lgc.c')
-rw-r--r--lgc.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/lgc.c b/lgc.c
index c5babfed..b7220cf1 100644
--- a/lgc.c
+++ b/lgc.c
@@ -569,10 +569,8 @@ static int traversethread (global_State *g, lua_State *th) {
569 th->openupval == NULL || isintwups(th)); 569 th->openupval == NULL || isintwups(th));
570 for (; o < th->top; o++) /* mark live elements in the stack */ 570 for (; o < th->top; o++) /* mark live elements in the stack */
571 markvalue(g, s2v(o)); 571 markvalue(g, s2v(o));
572 for (uv = th->openupval; uv != NULL; uv = uv->u.open.next) { 572 for (uv = th->openupval; uv != NULL; uv = uv->u.open.next)
573 if (uv->tbc) /* to be closed? */ 573 markobject(g, uv); /* open upvalues cannot be collected */
574 markobject(g, uv); /* cannot be collected */
575 }
576 if (g->gcstate == GCSatomic) { /* final traversal? */ 574 if (g->gcstate == GCSatomic) { /* final traversal? */
577 StkId lim = th->stack + th->stacksize; /* real end of stack */ 575 StkId lim = th->stack + th->stacksize; /* real end of stack */
578 for (; o < lim; o++) /* clear not-marked stack slice */ 576 for (; o < lim; o++) /* clear not-marked stack slice */