aboutsummaryrefslogtreecommitdiff
path: root/lgc.c
diff options
context:
space:
mode:
authorRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-11-29 16:22:09 -0300
committerRoberto Ierusalimschy <roberto@inf.puc-rio.br>2023-11-29 16:22:09 -0300
commit63d68bd657b7386c9c58b4439a100ea0ccbd633e (patch)
tree117ae53a7b1cbfd242370af0c5250fca85fd2a7d /lgc.c
parent011850a8f86f514d1ba2ebf7a9411c8036b917f4 (diff)
downloadlua-63d68bd657b7386c9c58b4439a100ea0ccbd633e.tar.gz
lua-63d68bd657b7386c9c58b4439a100ea0ccbd633e.tar.bz2
lua-63d68bd657b7386c9c58b4439a100ea0ccbd633e.zip
Comments detailing the ages for generational GC
Plus other comments and small details.
Diffstat (limited to 'lgc.c')
-rw-r--r--lgc.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/lgc.c b/lgc.c
index 3884aad0..daee5707 100644
--- a/lgc.c
+++ b/lgc.c
@@ -1121,6 +1121,7 @@ static GCObject **sweepgen (lua_State *L, global_State *g, GCObject **p,
1121 curr->marked = cast_byte(marked | G_SURVIVAL | white); 1121 curr->marked = cast_byte(marked | G_SURVIVAL | white);
1122 } 1122 }
1123 else { /* all other objects will be old, and so keep their color */ 1123 else { /* all other objects will be old, and so keep their color */
1124 lua_assert(getage(curr) != G_OLD1); /* advanced in 'markold' */
1124 setage(curr, nextage[getage(curr)]); 1125 setage(curr, nextage[getage(curr)]);
1125 if (getage(curr) == G_OLD1 && *pfirstold1 == NULL) 1126 if (getage(curr) == G_OLD1 && *pfirstold1 == NULL)
1126 *pfirstold1 = curr; /* first OLD1 object in the list */ 1127 *pfirstold1 = curr; /* first OLD1 object in the list */
@@ -1145,13 +1146,15 @@ static void whitelist (global_State *g, GCObject *p) {
1145 1146
1146 1147
1147/* 1148/*
1148** Correct a list of gray objects. Return pointer to where rest of the 1149** Correct a list of gray objects. Return a pointer to the last element
1149** list should be linked. 1150** left on the list, so that we can link another list to the end of
1151** this one.
1150** Because this correction is done after sweeping, young objects might 1152** Because this correction is done after sweeping, young objects might
1151** be turned white and still be in the list. They are only removed. 1153** be turned white and still be in the list. They are only removed.
1152** 'TOUCHED1' objects are advanced to 'TOUCHED2' and remain on the list; 1154** 'TOUCHED1' objects are advanced to 'TOUCHED2' and remain on the list;
1153** Non-white threads also remain on the list; 'TOUCHED2' objects become 1155** Non-white threads also remain on the list. 'TOUCHED2' objects and
1154** regular old; they and anything else are removed from the list. 1156** anything else become regular old, are marked black, and are removed
1157** from the list.
1155*/ 1158*/
1156static GCObject **correctgraylist (GCObject **p) { 1159static GCObject **correctgraylist (GCObject **p) {
1157 GCObject *curr; 1160 GCObject *curr;