aboutsummaryrefslogtreecommitdiff
path: root/lparser.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-06-16 09:54:20 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2020-06-16 09:54:20 -0300
commit6d7cd31feec58011a593cf732274a33dcc1bcb53 (patch)
treea464a23b3636c45c10b998046671573422fe075c /lparser.c
parent993c58fde3a85c27f52f094002ec57dabca81028 (diff)
downloadlua-6d7cd31feec58011a593cf732274a33dcc1bcb53.tar.gz
lua-6d7cd31feec58011a593cf732274a33dcc1bcb53.tar.bz2
lua-6d7cd31feec58011a593cf732274a33dcc1bcb53.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 37102b72..bc7d9a4f 100644
--- a/lparser.c
+++ b/lparser.c
@@ -737,6 +737,7 @@ static void open_func (LexState *ls, FuncState *fs, BlockCnt *bl) {
737 fs->firstlabel = ls->dyd->label.n; 737 fs->firstlabel = ls->dyd->label.n;
738 fs->bl = NULL; 738 fs->bl = NULL;
739 f->source = ls->source; 739 f->source = ls->source;
740 luaC_objbarrier(ls->L, f, f->source);
740 f->maxstacksize = 2; /* registers 0/1 are always valid */ 741 f->maxstacksize = 2; /* registers 0/1 are always valid */
741 enterblock(fs, bl, 0); 742 enterblock(fs, bl, 0);
742} 743}
@@ -1959,6 +1960,7 @@ static void mainfunc (LexState *ls, FuncState *fs) {
1959 env->idx = 0; 1960 env->idx = 0;
1960 env->kind = VDKREG; 1961 env->kind = VDKREG;
1961 env->name = ls->envn; 1962 env->name = ls->envn;
1963 luaC_objbarrier(ls->L, fs->f, env->name);
1962 luaX_next(ls); /* read first token */ 1964 luaX_next(ls); /* read first token */
1963 statlist(ls); /* parse main body */ 1965 statlist(ls); /* parse main body */
1964 check(ls, TK_EOS); 1966 check(ls, TK_EOS);
@@ -1977,6 +1979,7 @@ LClosure *luaY_parser (lua_State *L, ZIO *z, Mbuffer *buff,
1977 sethvalue2s(L, L->top, lexstate.h); /* anchor it */ 1979 sethvalue2s(L, L->top, lexstate.h); /* anchor it */
1978 luaD_inctop(L); 1980 luaD_inctop(L);
1979 funcstate.f = cl->p = luaF_newproto(L); 1981 funcstate.f = cl->p = luaF_newproto(L);
1982 luaC_objbarrier(L, cl, cl->p);
1980 funcstate.f->source = luaS_new(L, name); /* create and anchor TString */ 1983 funcstate.f->source = luaS_new(L, name); /* create and anchor TString */
1981 luaC_objbarrier(L, funcstate.f, funcstate.f->source); 1984 luaC_objbarrier(L, funcstate.f, funcstate.f->source);
1982 lexstate.buff = buff; 1985 lexstate.buff = buff;