Skip to content

Commit

Permalink
Fix incorrect comment in lgc.h (#1288)
Browse files Browse the repository at this point in the history
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.

Unfortunately this change is difficult to flag.

Fixes #1282.
  • Loading branch information
zeux authored Jun 7, 2024
1 parent 43bf7c4 commit 23b8726
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions VM/src/lgc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down

0 comments on commit 23b8726

Please sign in to comment.