1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-07-05 17:20:18 +02:00

nofl: Assert no forwarded object after GC in debug mode

This commit is contained in:
Andy Wingo 2025-07-03 10:21:31 +02:00
parent e098e55a8c
commit 162c5364b3

View file

@ -1374,6 +1374,13 @@ nofl_metadata_byte_trace_kind(struct nofl_space *space, uint8_t byte)
} }
} }
static void
nofl_assert_not_forwarded(struct gc_ref ref)
{
struct gc_atomic_forward fwd = gc_atomic_forward_begin(ref);
GC_ASSERT_EQ(fwd.state, GC_FORWARDING_STATE_NOT_FORWARDED);
}
static void static void
nofl_space_verify_sweepable_blocks(struct nofl_space *space, nofl_space_verify_sweepable_blocks(struct nofl_space *space,
struct nofl_block_list *list) struct nofl_block_list *list)
@ -1401,6 +1408,8 @@ nofl_space_verify_sweepable_blocks(struct nofl_space *space,
gc_trace_object(obj, NULL, NULL, NULL, &trace_bytes); gc_trace_object(obj, NULL, NULL, NULL, &trace_bytes);
size_t trace_granules = nofl_size_to_granules(trace_bytes); size_t trace_granules = nofl_size_to_granules(trace_bytes);
GC_ASSERT_EQ(granules, trace_granules); GC_ASSERT_EQ(granules, trace_granules);
nofl_assert_not_forwarded(obj);
} }
meta += granules; meta += granules;
@ -1441,6 +1450,8 @@ nofl_space_verify_swept_blocks(struct nofl_space *space,
gc_trace_object(obj, NULL, NULL, NULL, &trace_bytes); gc_trace_object(obj, NULL, NULL, NULL, &trace_bytes);
size_t trace_granules = nofl_size_to_granules(trace_bytes); size_t trace_granules = nofl_size_to_granules(trace_bytes);
GC_ASSERT_EQ(granules, trace_granules); GC_ASSERT_EQ(granules, trace_granules);
nofl_assert_not_forwarded(obj);
} }
meta += granules; meta += granules;