summaryrefslogtreecommitdiff
path: root/src/gc/sms.c
diff options
context:
space:
mode:
authorNathan Ringo <nathan@remexre.com>2024-11-28 20:13:45 -0600
committerNathan Ringo <nathan@remexre.com>2024-11-28 20:13:45 -0600
commit16e22f9cb39a254bccd20613f7c2cfef75ae15a7 (patch)
tree2f5ce4d1676b8a5d6e127b773e755c8d622724aa /src/gc/sms.c
parent6f9c0c5afb2877c0e95586a6db123029eba86b9b (diff)
Fixes GC bug.
Diffstat (limited to 'src/gc/sms.c')
-rw-r--r--src/gc/sms.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/gc/sms.c b/src/gc/sms.c
index 6261dc1..a2ab18e 100644
--- a/src/gc/sms.c
+++ b/src/gc/sms.c
@@ -95,7 +95,7 @@ static void gc_mark(const struct value initial_value) {
// - A black object has its mark bit set, but is not pointed to by obj, nor is
// it in the prev linked list.
struct object *prev = NULL;
- while (obj) {
+ for (;;) {
// INVARIANT: obj points to a white object that we're about to make gray.
// Since it's white, none of its fields should have the tag TAG_GC_INTERNAL,
// so it shouldn't have a saved tag either.
@@ -199,6 +199,7 @@ static void gc_sweep(void) {
while ((header = *head)) {
if ((*head)->mark) {
(*head)->mark = false;
+ (*head)->saved_tag = 0;
head = &header->next;
} else {
*head = header->next;