From 2c3fac891d570ffb3352219610e84b337b35285b Mon Sep 17 00:00:00 2001 From: Arseny Kapoulkine Date: Fri, 7 Jun 2024 09:36:29 -0700 Subject: [PATCH] Fix incorrect comment in lgc.h The comment gave an incorrect (reversed) version of the invariant, which could be confusing for people who haven't read the full description in lgc.cpp. --- VM/src/lgc.h | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/VM/src/lgc.h b/VM/src/lgc.h index ba433c67..010d7e86 100644 --- a/VM/src/lgc.h +++ b/VM/src/lgc.h @@ -23,11 +23,10 @@ #define GCSsweep 4 /* -** macro to tell when main invariant (white objects cannot point to black -** ones) must be kept. During a collection, the sweep -** phase may break the invariant, as objects turned white may point to -** still-black objects. The invariant is restored when sweep ends and -** all objects are white again. +** The main invariant of the garbage collector, while marking objects, +** is that a black object can never point to a white one. This invariant +** is not being enforced during a sweep phase, and is restored when sweep +** ends. */ #define keepinvariant(g) ((g)->gcstate == GCSpropagate || (g)->gcstate == GCSpropagateagain || (g)->gcstate == GCSatomic)