diff options
author | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-29 16:22:09 -0300 |
---|---|---|
committer | Roberto Ierusalimschy <roberto@inf.puc-rio.br> | 2023-11-29 16:22:09 -0300 |
commit | 63d68bd657b7386c9c58b4439a100ea0ccbd633e (patch) | |
tree | 117ae53a7b1cbfd242370af0c5250fca85fd2a7d /ltests.c | |
parent | 011850a8f86f514d1ba2ebf7a9411c8036b917f4 (diff) | |
download | lua-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 'ltests.c')
-rw-r--r-- | ltests.c | 10 |
1 files changed, 6 insertions, 4 deletions
@@ -302,8 +302,8 @@ static int testobjref1 (global_State *g, GCObject *f, GCObject *t) { | |||
302 | else { /* generational mode */ | 302 | else { /* generational mode */ |
303 | if ((getage(f) == G_OLD && isblack(f)) && !isold(t)) | 303 | if ((getage(f) == G_OLD && isblack(f)) && !isold(t)) |
304 | return 0; | 304 | return 0; |
305 | if (((getage(f) == G_OLD1 || getage(f) == G_TOUCHED2) && isblack(f)) && | 305 | if ((getage(f) == G_OLD1 || getage(f) == G_TOUCHED2) && |
306 | getage(t) == G_NEW) | 306 | getage(t) == G_NEW) |
307 | return 0; | 307 | return 0; |
308 | return 1; | 308 | return 1; |
309 | } | 309 | } |
@@ -510,7 +510,8 @@ static void checkrefs (global_State *g, GCObject *o) { | |||
510 | ** * objects must be old enough for their lists ('listage'). | 510 | ** * objects must be old enough for their lists ('listage'). |
511 | ** * old objects cannot be white. | 511 | ** * old objects cannot be white. |
512 | ** * old objects must be black, except for 'touched1', 'old0', | 512 | ** * old objects must be black, except for 'touched1', 'old0', |
513 | ** threads, and open upvalues. | 513 | ** threads, and open upvalues. |
514 | ** * 'touched1' objects must be gray. | ||
514 | */ | 515 | */ |
515 | static void checkobject (global_State *g, GCObject *o, int maybedead, | 516 | static void checkobject (global_State *g, GCObject *o, int maybedead, |
516 | int listage) { | 517 | int listage) { |
@@ -520,14 +521,15 @@ static void checkobject (global_State *g, GCObject *o, int maybedead, | |||
520 | assert(g->gcstate != GCSpause || iswhite(o)); | 521 | assert(g->gcstate != GCSpause || iswhite(o)); |
521 | if (g->gckind == KGC_GEN) { /* generational mode? */ | 522 | if (g->gckind == KGC_GEN) { /* generational mode? */ |
522 | assert(getage(o) >= listage); | 523 | assert(getage(o) >= listage); |
523 | assert(!iswhite(o) || !isold(o)); | ||
524 | if (isold(o)) { | 524 | if (isold(o)) { |
525 | assert(!iswhite(o)); | ||
525 | assert(isblack(o) || | 526 | assert(isblack(o) || |
526 | getage(o) == G_TOUCHED1 || | 527 | getage(o) == G_TOUCHED1 || |
527 | getage(o) == G_OLD0 || | 528 | getage(o) == G_OLD0 || |
528 | o->tt == LUA_VTHREAD || | 529 | o->tt == LUA_VTHREAD || |
529 | (o->tt == LUA_VUPVAL && upisopen(gco2upv(o)))); | 530 | (o->tt == LUA_VUPVAL && upisopen(gco2upv(o)))); |
530 | } | 531 | } |
532 | assert(getage(o) != G_TOUCHED1 || isgray(o)); | ||
531 | } | 533 | } |
532 | checkrefs(g, o); | 534 | checkrefs(g, o); |
533 | } | 535 | } |