diff options
Diffstat (limited to 'lgc.c')
-rw-r--r-- | lgc.c | 24 |
1 files changed, 12 insertions, 12 deletions
@@ -431,7 +431,7 @@ static void genlink (global_State *g, GCObject *o) { | |||
431 | linkobjgclist(o, g->grayagain); /* link it back in 'grayagain' */ | 431 | linkobjgclist(o, g->grayagain); /* link it back in 'grayagain' */ |
432 | } /* everything else do not need to be linked back */ | 432 | } /* everything else do not need to be linked back */ |
433 | else if (getage(o) == G_TOUCHED2) | 433 | else if (getage(o) == G_TOUCHED2) |
434 | changeage(o, G_TOUCHED2, G_OLD); /* advance age */ | 434 | setage(o, G_OLD); /* advance age */ |
435 | } | 435 | } |
436 | 436 | ||
437 | 437 | ||
@@ -826,9 +826,9 @@ static void freeobj (lua_State *L, GCObject *o) { | |||
826 | /* | 826 | /* |
827 | ** sweep at most 'countin' elements from a list of GCObjects erasing dead | 827 | ** sweep at most 'countin' elements from a list of GCObjects erasing dead |
828 | ** objects, where a dead object is one marked with the old (non current) | 828 | ** objects, where a dead object is one marked with the old (non current) |
829 | ** white; change all non-dead objects back to white, preparing for next | 829 | ** white; change all non-dead objects back to white (and new), preparing |
830 | ** collection cycle. Return where to continue the traversal or NULL if | 830 | ** for next collection cycle. Return where to continue the traversal or |
831 | ** list is finished. | 831 | ** NULL if list is finished. |
832 | */ | 832 | */ |
833 | static GCObject **sweeplist (lua_State *L, GCObject **p, int countin) { | 833 | static GCObject **sweeplist (lua_State *L, GCObject **p, int countin) { |
834 | global_State *g = G(L); | 834 | global_State *g = G(L); |
@@ -842,8 +842,8 @@ static GCObject **sweeplist (lua_State *L, GCObject **p, int countin) { | |||
842 | *p = curr->next; /* remove 'curr' from list */ | 842 | *p = curr->next; /* remove 'curr' from list */ |
843 | freeobj(L, curr); /* erase 'curr' */ | 843 | freeobj(L, curr); /* erase 'curr' */ |
844 | } | 844 | } |
845 | else { /* change mark to 'white' */ | 845 | else { /* change mark to 'white' and age to 'new' */ |
846 | curr->marked = cast_byte((marked & ~maskgcbits) | white); | 846 | curr->marked = cast_byte((marked & ~maskgcbits) | white | G_NEW); |
847 | p = &curr->next; /* go to next element */ | 847 | p = &curr->next; /* go to next element */ |
848 | } | 848 | } |
849 | } | 849 | } |
@@ -1042,8 +1042,8 @@ void luaC_checkfinalizer (lua_State *L, GCObject *o, Table *mt) { | |||
1042 | 1042 | ||
1043 | 1043 | ||
1044 | /* | 1044 | /* |
1045 | ** Set the "time" to wait before starting a new GC cycle; cycle will | 1045 | ** Set the "time" to wait before starting a new incremental cycle; |
1046 | ** start when number of objects in use hits the threshold of | 1046 | ** cycle will start when number of objects in use hits the threshold of |
1047 | ** approximately (marked * pause / 100). | 1047 | ** approximately (marked * pause / 100). |
1048 | */ | 1048 | */ |
1049 | static void setpause (global_State *g) { | 1049 | static void setpause (global_State *g) { |
@@ -1165,7 +1165,7 @@ static GCObject **correctgraylist (GCObject **p) { | |||
1165 | else if (getage(curr) == G_TOUCHED1) { /* touched in this cycle? */ | 1165 | else if (getage(curr) == G_TOUCHED1) { /* touched in this cycle? */ |
1166 | lua_assert(isgray(curr)); | 1166 | lua_assert(isgray(curr)); |
1167 | nw2black(curr); /* make it black, for next barrier */ | 1167 | nw2black(curr); /* make it black, for next barrier */ |
1168 | changeage(curr, G_TOUCHED1, G_TOUCHED2); | 1168 | setage(curr, G_TOUCHED2); |
1169 | goto remain; /* keep it in the list and go to next element */ | 1169 | goto remain; /* keep it in the list and go to next element */ |
1170 | } | 1170 | } |
1171 | else if (curr->tt == LUA_VTHREAD) { | 1171 | else if (curr->tt == LUA_VTHREAD) { |
@@ -1175,7 +1175,7 @@ static GCObject **correctgraylist (GCObject **p) { | |||
1175 | else { /* everything else is removed */ | 1175 | else { /* everything else is removed */ |
1176 | lua_assert(isold(curr)); /* young objects should be white here */ | 1176 | lua_assert(isold(curr)); /* young objects should be white here */ |
1177 | if (getage(curr) == G_TOUCHED2) /* advance from TOUCHED2... */ | 1177 | if (getage(curr) == G_TOUCHED2) /* advance from TOUCHED2... */ |
1178 | changeage(curr, G_TOUCHED2, G_OLD); /* ... to OLD */ | 1178 | setage(curr, G_OLD); /* ... to OLD */ |
1179 | nw2black(curr); /* make object black (to be removed) */ | 1179 | nw2black(curr); /* make object black (to be removed) */ |
1180 | goto remove; | 1180 | goto remove; |
1181 | } | 1181 | } |
@@ -1210,7 +1210,7 @@ static void markold (global_State *g, GCObject *from, GCObject *to) { | |||
1210 | for (p = from; p != to; p = p->next) { | 1210 | for (p = from; p != to; p = p->next) { |
1211 | if (getage(p) == G_OLD1) { | 1211 | if (getage(p) == G_OLD1) { |
1212 | lua_assert(!iswhite(p)); | 1212 | lua_assert(!iswhite(p)); |
1213 | changeage(p, G_OLD1, G_OLD); /* now they are old */ | 1213 | setage(p, G_OLD); /* now they are old */ |
1214 | if (isblack(p)) | 1214 | if (isblack(p)) |
1215 | reallymarkobject(g, p); | 1215 | reallymarkobject(g, p); |
1216 | } | 1216 | } |
@@ -1399,7 +1399,7 @@ static void genmajorstep (lua_State *L, global_State *g) { | |||
1399 | static void genstep (lua_State *L, global_State *g) { | 1399 | static void genstep (lua_State *L, global_State *g) { |
1400 | l_obj majorbase = g->GClastmajor; /* count after last major collection */ | 1400 | l_obj majorbase = g->GClastmajor; /* count after last major collection */ |
1401 | l_obj majorinc = applygcparam(g, genmajormul, majorbase); | 1401 | l_obj majorinc = applygcparam(g, genmajormul, majorbase); |
1402 | if (gettotalobjs(g) > majorbase + majorinc && 0) { | 1402 | if (gettotalobjs(g) > majorbase + majorinc) { |
1403 | /* do a major collection */ | 1403 | /* do a major collection */ |
1404 | enterinc(g); | 1404 | enterinc(g); |
1405 | g->gckind = KGC_GENMAJOR; | 1405 | g->gckind = KGC_GENMAJOR; |