diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-06-18 15:56:45 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-06-18 15:56:45 -0300 |
commit | f5eb809d3f1da13683cd02184042e67228206205 (patch) | |
tree | 68177f3b093bce54c4293ae68bb2d9a9fc5ea496 /lparser.c | |
parent | d71a548685eb3ac5ea598d6a9e7481389c558808 (diff) | |
download | lua-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.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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; |