Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/policy/copyspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ impl<VM: VMBinding> CopySpace<VM> {

// Clear VO bits because all objects in the space are dead.
#[cfg(feature = "vo_bit")]
crate::util::metadata::vo_bit::bzero_vo_bit(start, size);
crate::util::metadata::side_metadata::bzero_vo_bit(start, size);
}

unsafe {
Expand Down
6 changes: 4 additions & 2 deletions src/policy/immix/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@ use crate::util::linear_scan::{Region, RegionIterator};
use crate::util::metadata::side_metadata::{MetadataByteArrayRef, SideMetadataSpec};
#[cfg(feature = "vo_bit")]
use crate::util::metadata::vo_bit;
#[cfg(feature = "vo_bit")]
use crate::util::metadata::side_metadata;
use crate::util::Address;
use crate::vm::*;
use std::sync::atomic::Ordering;
Expand Down Expand Up @@ -280,7 +282,7 @@ impl Block {
match self.get_state() {
BlockState::Unmarked => {
// It may contain young objects. Clear it.
vo_bit::bzero_vo_bit(self.start(), Self::BYTES);
side_metadata::bzero_vo_bit(self.start(), Self::BYTES);
}
BlockState::Marked => {
// It contains old objects. Skip it.
Expand All @@ -293,7 +295,7 @@ impl Block {
for line in self.lines() {
if !line.is_marked(state) {
// It may contain young objects. Clear it.
vo_bit::bzero_vo_bit(line.start(), Line::BYTES);
side_metadata::bzero_vo_bit(line.start(), Line::BYTES);
}
}
}
Expand Down
4 changes: 3 additions & 1 deletion src/policy/immix/immixspace.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@ use crate::util::linear_scan::{Region, RegionIterator};
use crate::util::metadata::side_metadata::SideMetadataSpec;
#[cfg(feature = "vo_bit")]
use crate::util::metadata::vo_bit;
#[cfg(feature = "vo_bit")]
use crate::util::metadata::side_metadata;
use crate::util::metadata::{self, MetadataSpec};
use crate::util::object_forwarding;
use crate::util::{Address, ObjectReference};
Expand Down Expand Up @@ -1096,7 +1098,7 @@ impl<VM: VMBinding> GCWork<VM> for ClearVOBitsAfterPrepare {
fn do_work(&mut self, _worker: &mut GCWorker<VM>, _mmtk: &'static MMTK<VM>) {
match self.scope {
VOBitsClearingScope::FullGC => {
vo_bit::bzero_vo_bit(self.chunk.start(), Chunk::BYTES);
side_metadata::bzero_vo_bit(self.chunk.start(), Chunk::BYTES);
}
VOBitsClearingScope::BlockOnly => {
self.clear_blocks(None);
Expand Down
2 changes: 1 addition & 1 deletion src/policy/marksweepspace/native_ms/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -361,7 +361,7 @@ impl Block {

// Clear VO bit: we don't know where the object reference actually is, so we bulk zero the cell.
#[cfg(feature = "vo_bit")]
crate::util::metadata::vo_bit::bzero_vo_bit(cell, cell_size);
crate::util::metadata::side_metadata::bzero_vo_bit(cell, cell_size);

// store the previous cell to make the free list
debug_assert!(last.is_zero() || (last >= self.start() && last < self.end()));
Expand Down
2 changes: 1 addition & 1 deletion src/policy/marksweepspace/native_ms/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -379,7 +379,7 @@ impl<VM: VMBinding> MarkSweepSpace<VM> {
metadata_spec.set_zero_atomic(block.start(), Ordering::SeqCst);
}
#[cfg(feature = "vo_bit")]
crate::util::metadata::vo_bit::bzero_vo_bit(block.start(), Block::BYTES);
crate::util::metadata::side_metadata::bzero_vo_bit(block.start(), Block::BYTES);
}

pub fn acquire_block(&self, tls: VMThread, size: usize, align: usize) -> BlockAcquireResult {
Expand Down
12 changes: 12 additions & 0 deletions src/util/metadata/side_metadata/global.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,18 @@ use std::fmt;
use std::io::Result;
use std::sync::atomic::{AtomicU8, Ordering};

#[cfg(feature = "vo_bit")]
Copy link
Collaborator

@wks wks Jun 26, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's just not right to put VO bit specific functions in side_metadata::global. I suggest we make the vo_bit module public, and mark functions not intended to be public as pub(crate). It is actually part of the plan to make vo_bit public. See: #804 (Update: Sorry. I think that issue conflicts with our recent discussion in some ways. But feel free to make the vo_bit module public.)

/// Bulk zero the VO bit.
pub fn bzero_vo_bit(start: Address, size: usize) {
VO_BIT_SIDE_METADATA_SPEC.bzero_metadata(start, size);
}
#[cfg(feature = "vo_bit")]
/// Bulk set the VO bit.
pub fn bset_vo_bit(start: Address, size: usize) {
VO_BIT_SIDE_METADATA_SPEC.bset_metadata(start, size);
}


/// This struct stores the specification of a side metadata bit-set.
/// It is used as an input to the (inline) functions provided by the side metadata module.
///
Expand Down
2 changes: 1 addition & 1 deletion src/util/metadata/vo_bit/helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ pub(crate) fn on_region_swept<VM: VMBinding, R: Region>(region: &R, is_occupied:
vo_bit::bcopy_vo_bit_from_mark_bit::<VM>(region.start(), R::BYTES);
} else {
// If the block has no live objects, simply clear the VO bits.
vo_bit::bzero_vo_bit(region.start(), R::BYTES);
crate::util::metadata::side_metadata::bzero_vo_bit(region.start(), R::BYTES);
}
}
}
Expand Down
5 changes: 0 additions & 5 deletions src/util/metadata/vo_bit/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,11 +140,6 @@ pub unsafe fn is_vo_bit_set_unsafe<VM: VMBinding>(address: Address) -> Option<Ob
}
}

/// Bulk zero the VO bit.
pub fn bzero_vo_bit(start: Address, size: usize) {
VO_BIT_SIDE_METADATA_SPEC.bzero_metadata(start, size);
}

/// Bulk copy VO bits from side mark bits.
/// Some VMs require the VO bits to be available during tracing.
/// However, some GC algorithms (such as Immix) cannot clear VO bits for dead objects only.
Expand Down