Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

No need to atomically set VO bit in post_alloc? #1156

Open
qinsoon opened this issue Jun 25, 2024 · 1 comment
Open

No need to atomically set VO bit in post_alloc? #1156

qinsoon opened this issue Jun 25, 2024 · 1 comment

Comments

@qinsoon
Copy link
Member

qinsoon commented Jun 25, 2024

For allocators that have its allocation buffer, it seems unnecesary to set VO bit atomically.

fn initialize_object_metadata(&self, _object: ObjectReference, _alloc: bool) {
#[cfg(feature = "vo_bit")]
crate::util::metadata::vo_bit::set_vo_bit::<VM>(_object);
}

pub fn set_vo_bit<VM: VMBinding>(object: ObjectReference) {
debug_assert!(
!is_vo_bit_set::<VM>(object),
"{:x}: VO bit already set",
object
);
VO_BIT_SIDE_METADATA_SPEC.store_atomic::<u8>(object.to_address::<VM>(), 1, Ordering::SeqCst);
}

@wks
Copy link
Collaborator

wks commented Jun 25, 2024

That's right. It should include all bump-pointer allocators and the native MarkSweep, too (because each thread allocates in its own block).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants