diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-29 09:58:25 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2020-07-29 09:58:25 -0300 |
commit | 71f70df3271f6e8ae9e8efcaef3be19f8d37c161 (patch) | |
tree | 80a46e8d26509f20319e0f66433fc63ba4a82318 | |
parent | 663f83f647f9199541ce1b60a6496b4124b4fdd3 (diff) | |
download | lua-71f70df3271f6e8ae9e8efcaef3be19f8d37c161.tar.gz lua-71f70df3271f6e8ae9e8efcaef3be19f8d37c161.tar.bz2 lua-71f70df3271f6e8ae9e8efcaef3be19f8d37c161.zip |
OLD1 ages advanced by 'markold'
Objects aged OLD1 have their ages advanced by 'markold', which has to
visit them anyway. So, the GC doesn't need to "sweep" the old1 list.
-rw-r--r-- | lgc.c | 11 |
1 files changed, 6 insertions, 5 deletions
@@ -1131,7 +1131,7 @@ static void correctgraylists (global_State *g) { | |||
1131 | 1131 | ||
1132 | 1132 | ||
1133 | /* | 1133 | /* |
1134 | ** Mark 'OLD1' objects when starting a new young collection. | 1134 | ** Mark black 'OLD1' objects when starting a new young collection. |
1135 | ** Gray objects are already in some gray list, and so will be visited | 1135 | ** Gray objects are already in some gray list, and so will be visited |
1136 | ** in the atomic step. | 1136 | ** in the atomic step. |
1137 | */ | 1137 | */ |
@@ -1140,6 +1140,7 @@ static void markold (global_State *g, GCObject *from, GCObject *to) { | |||
1140 | for (p = from; p != to; p = p->next) { | 1140 | for (p = from; p != to; p = p->next) { |
1141 | if (getage(p) == G_OLD1) { | 1141 | if (getage(p) == G_OLD1) { |
1142 | lua_assert(!iswhite(p)); | 1142 | lua_assert(!iswhite(p)); |
1143 | changeage(p, G_OLD1, G_OLD); /* now they are old */ | ||
1143 | if (isblack(p)) { | 1144 | if (isblack(p)) { |
1144 | black2gray(p); /* should be '2white', but gray works too */ | 1145 | black2gray(p); /* should be '2white', but gray works too */ |
1145 | reallymarkobject(g, p); | 1146 | reallymarkobject(g, p); |
@@ -1176,16 +1177,16 @@ static void youngcollection (lua_State *L, global_State *g) { | |||
1176 | /* sweep nursery and get a pointer to its last live element */ | 1177 | /* sweep nursery and get a pointer to its last live element */ |
1177 | g->gcstate = GCSswpallgc; | 1178 | g->gcstate = GCSswpallgc; |
1178 | psurvival = sweepgen(L, g, &g->allgc, g->survival); | 1179 | psurvival = sweepgen(L, g, &g->allgc, g->survival); |
1179 | /* sweep 'survival' and 'old' */ | 1180 | /* sweep 'survival' */ |
1180 | sweepgen(L, g, psurvival, g->reallyold); | 1181 | sweepgen(L, g, psurvival, g->old); |
1181 | g->reallyold = g->old; | 1182 | g->reallyold = g->old; |
1182 | g->old = *psurvival; /* 'survival' survivals are old now */ | 1183 | g->old = *psurvival; /* 'survival' survivals are old now */ |
1183 | g->survival = g->allgc; /* all news are survivals */ | 1184 | g->survival = g->allgc; /* all news are survivals */ |
1184 | 1185 | ||
1185 | /* repeat for 'finobj' lists */ | 1186 | /* repeat for 'finobj' lists */ |
1186 | psurvival = sweepgen(L, g, &g->finobj, g->finobjsur); | 1187 | psurvival = sweepgen(L, g, &g->finobj, g->finobjsur); |
1187 | /* sweep 'survival' and 'old' */ | 1188 | /* sweep 'survival' */ |
1188 | sweepgen(L, g, psurvival, g->finobjrold); | 1189 | sweepgen(L, g, psurvival, g->finobjold); |
1189 | g->finobjrold = g->finobjold; | 1190 | g->finobjrold = g->finobjold; |
1190 | g->finobjold = *psurvival; /* 'survival' survivals are old now */ | 1191 | g->finobjold = *psurvival; /* 'survival' survivals are old now */ |
1191 | g->finobjsur = g->finobj; /* all news are survivals */ | 1192 | g->finobjsur = g->finobj; /* all news are survivals */ |