diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-04-01 14:22:07 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2019-04-01 14:22:07 -0300 |
commit | 38425e069243fe6d991f2e99b4bba192af3563c7 (patch) | |
tree | 5555a4e2ed09248886d6bfc569e7c9c994796d50 | |
parent | d12262068d689eacc452a459a021df0ad8f6d46c (diff) | |
download | lua-38425e069243fe6d991f2e99b4bba192af3563c7.tar.gz lua-38425e069243fe6d991f2e99b4bba192af3563c7.tar.bz2 lua-38425e069243fe6d991f2e99b4bba192af3563c7.zip |
Avoid moving the collector while in 'GCSenteratomic' state
The 'GCSenteratomic' is just an auxiliary state for transitioning
to 'GCSatomic'. All GC traversals should be done either on the
'GCSpropagate' state or the 'GCSatomic' state.
-rw-r--r-- | lgc.c | 4 |
1 files changed, 2 insertions, 2 deletions
@@ -1423,6 +1423,7 @@ static lu_mem atomic (lua_State *L) { | |||
1423 | /* registry and global metatables may be changed by API */ | 1423 | /* registry and global metatables may be changed by API */ |
1424 | markvalue(g, &g->l_registry); | 1424 | markvalue(g, &g->l_registry); |
1425 | markmt(g); /* mark global metatables */ | 1425 | markmt(g); /* mark global metatables */ |
1426 | work += propagateall(g); /* empties 'gray' list */ | ||
1426 | /* remark occasional upvalues of (maybe) dead threads */ | 1427 | /* remark occasional upvalues of (maybe) dead threads */ |
1427 | work += remarkupvals(g); | 1428 | work += remarkupvals(g); |
1428 | work += propagateall(g); /* propagate changes */ | 1429 | work += propagateall(g); /* propagate changes */ |
@@ -1486,8 +1487,7 @@ static lu_mem singlestep (lua_State *L) { | |||
1486 | return propagatemark(g); /* traverse one gray object */ | 1487 | return propagatemark(g); /* traverse one gray object */ |
1487 | } | 1488 | } |
1488 | case GCSenteratomic: { | 1489 | case GCSenteratomic: { |
1489 | lu_mem work = propagateall(g); /* make sure gray list is empty */ | 1490 | lu_mem work = atomic(L); /* work is what was traversed by 'atomic' */ |
1490 | work += atomic(L); /* work is what was traversed by 'atomic' */ | ||
1491 | entersweep(L); | 1491 | entersweep(L); |
1492 | g->GCestimate = gettotalbytes(g); /* first estimate */; | 1492 | g->GCestimate = gettotalbytes(g); /* first estimate */; |
1493 | return work; | 1493 | return work; |