1
Fork 0
mirror of https://git.savannah.gnu.org/git/guile.git synced 2025-05-02 21:10:27 +02:00

nofl: Fix sticky mark bit treatment for block marks

This commit is contained in:
Andy Wingo 2024-08-25 08:45:17 +02:00
parent b8c0fa0e90
commit 7b4a56c51a

View file

@ -930,9 +930,21 @@ nofl_space_update_mark_patterns(struct nofl_space *space,
space->sweep_mask = broadcast_byte(space->live_mask); space->sweep_mask = broadcast_byte(space->live_mask);
} }
static void
nofl_space_clear_block_marks(struct nofl_space *space) {
for (size_t s = 0; s < space->nslabs; s++) {
struct nofl_slab *slab = &space->slabs[s];
memset(&slab->header.block_marks, 0, NOFL_BLOCKS_PER_SLAB / 8);
}
}
static void static void
nofl_space_prepare_gc(struct nofl_space *space, enum gc_collection_kind kind) { nofl_space_prepare_gc(struct nofl_space *space, enum gc_collection_kind kind) {
nofl_space_update_mark_patterns(space, !(kind == GC_COLLECTION_MINOR)); int is_minor = kind == GC_COLLECTION_MINOR;
if (!is_minor) {
nofl_space_update_mark_patterns(space, 1);
nofl_space_clear_block_marks(space);
}
} }
static void static void
@ -1122,7 +1134,6 @@ nofl_space_finish_gc(struct nofl_space *space,
uintptr_t block; uintptr_t block;
while ((block = nofl_pop_block(&space->to_sweep))) { while ((block = nofl_pop_block(&space->to_sweep))) {
if (nofl_block_is_marked(block)) { if (nofl_block_is_marked(block)) {
nofl_block_clear_mark(block);
nofl_push_block(&to_sweep, block); nofl_push_block(&to_sweep, block);
} else { } else {
// Block is empty. // Block is empty.