aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-06-18 15:56:45 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-06-18 15:56:45 -0300
commitf5eb809d3f1da13683cd02184042e67228206205 (patch)
tree68177f3b093bce54c4293ae68bb2d9a9fc5ea496 /lparser.c
parentd71a548685eb3ac5ea598d6a9e7481389c558808 (diff)
downloadlua-f5eb809d3f1da13683cd02184042e67228206205.tar.gz
lua-f5eb809d3f1da13683cd02184042e67228206205.tar.bz2
lua-f5eb809d3f1da13683cd02184042e67228206205.zip
Fixed missing GC barriers in compiler and undump
While building a new prototype, the GC needs barriers for every object (strings and nested prototypes) that is attached to the new prototype.
Diffstat (limited to 'lparser.c')
-rw-r--r--lparser.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/lparser.c b/lparser.c
index cc54de43..2f41e00b 100644
--- a/lparser.c
+++ b/lparser.c
@@ -544,6 +544,7 @@ static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) {
544 fs->bl = NULL; 544 fs->bl = NULL;
545 f = fs->f; 545 f = fs->f;
546 f->source = ls->source; 546 f->source = ls->source;
547 luaC_objbarrier(ls->L, f, f->source);
547 f->maxstacksize = 2; /* registers 0/1 are always valid */ 548 f->maxstacksize = 2; /* registers 0/1 are always valid */
548 enterblock(fs, bl, 0); 549 enterblock(fs, bl, 0);
549} 550}
@@ -1616,6 +1617,7 @@ static void mainfunc (LexState *ls, FuncState *fs) {
1616 fs->f->is_vararg = 1; /* main function is always declared vararg */ 1617 fs->f->is_vararg = 1; /* main function is always declared vararg */
1617 init_exp(&v, VLOCAL, 0); /* create and... */ 1618 init_exp(&v, VLOCAL, 0); /* create and... */
1618 newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */ 1619 newupvalue(fs, ls->envn, &v); /* ...set environment upvalue */
1620 luaC_objbarrier(ls->L, fs->f, ls->envn);
1619 luaX_next(ls); /* read first token */ 1621 luaX_next(ls); /* read first token */
1620 statlist(ls); /* parse main body */ 1622 statlist(ls); /* parse main body */
1621 check(ls, TK_EOS); 1623 check(ls, TK_EOS);
@@ -1634,6 +1636,7 @@ LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
1634 sethvalue(L, L->top, lexstate.h); /* anchor it */ 1636 sethvalue(L, L->top, lexstate.h); /* anchor it */
1635 luaD_inctop(L); 1637 luaD_inctop(L);
1636 funcstate.f = cl->p = luaF_newproto(L); 1638 funcstate.f = cl->p = luaF_newproto(L);
1639 luaC_objbarrier(L, cl, cl->p);
1637 funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ 1640 funcstate.f->source = luaS_new(L, name); /* create and anchor TString */
1638 lua_assert(iswhite(funcstate.f)); /* do not need barrier here */ 1641 lua_assert(iswhite(funcstate.f)); /* do not need barrier here */
1639 lexstate.buff = buff; 1642 lexstate.buff = buff;