Skip to content

Commit 7953aa4

Browse files
authored
Immix: Clear alloc bits during sweeping (#748)
No longer clear alloc bit when an object is being moved. This fixes an assertion error when trace_object is called on the same object twice during defrag GC. Clear alloc bits eagerly during sweeping instead of during allocation. This ensures an address has the alloc bit (i.e. valid-object bit) if and only if that address corresponds to a valid object reference during mutator execution.
1 parent bde20a5 commit 7953aa4

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

src/policy/immix/block.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,9 @@ impl Block {
241241
holes += 1;
242242
}
243243

244+
#[cfg(feature = "global_alloc_bit")]
245+
crate::util::alloc_bit::bzero_alloc_bit(line.start(), Line::BYTES);
246+
244247
#[cfg(feature = "immix_zero_on_release")]
245248
crate::util::memory::zero(line.start(), Line::BYTES);
246249

src/policy/immix/immixspace.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -510,8 +510,6 @@ impl<VM: VMBinding> ImmixSpace<VM> {
510510
Block::containing::<VM>(object).set_state(BlockState::Marked);
511511
object
512512
} else {
513-
#[cfg(feature = "global_alloc_bit")]
514-
crate::util::alloc_bit::unset_alloc_bit::<VM>(object);
515513
ForwardingWord::forward_object::<VM>(object, semantics, copy_context)
516514
};
517515
debug_assert_eq!(

src/util/alloc/immix_allocator.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -257,8 +257,6 @@ impl<VM: VMBinding> ImmixAllocator<VM> {
257257
end_line,
258258
self.tls
259259
);
260-
#[cfg(feature = "global_alloc_bit")]
261-
crate::util::alloc_bit::bzero_alloc_bit(self.cursor, self.limit - self.cursor);
262260
crate::util::memory::zero(self.cursor, self.limit - self.cursor);
263261
debug_assert!(
264262
align_allocation_no_fill::<VM>(self.cursor, align, offset) + size <= self.limit

0 commit comments

Comments
 (0)