-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCI-libs-api-nominatedNominated for discussion during a libs-api team meeting.Nominated for discussion during a libs-api team meeting.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.
Description
Feature gate: #![feature(strict_provenance_atomic_ptr)]
This is a tracking issue for arithmetic and certain bitwise operations on AtomicPtr
.
As part of the strict provenance experiment #95228.
This feature adds arithmetic (add
, sub
) and bitwise (or
, end
, xor
) atomic operations for AtomicPtr
in order to replace uses of AtomicUsize
-but-actually-a-pointer to preserve provenance information for the compiler and remove usize
->ptr
casts from existing code.
Arithmetic ops behave as the their non-atomic wrapping versions. Bitwise ops behave as .map_addr(|x| x op val)
.
Public API
// core::sync::atomic
impl<T> AtomicPtr<T> {
pub fn fetch_ptr_add(&self, val: usize, order: Ordering) -> *mut T;
pub fn fetch_ptr_sub(&self, val: usize, order: Ordering) -> *mut T;
pub fn fetch_byte_add(&self, val: usize, order: Ordering) -> *mut T;
pub fn fetch_byte_sub(&self, val: usize, order: Ordering) -> *mut T;
pub fn fetch_or(&self, val: usize, order: Ordering) -> *mut T;
pub fn fetch_and(&self, val: usize, order: Ordering) -> *mut T;
pub fn fetch_xor(&self, val: usize, order: Ordering) -> *mut T;
}
Steps / History
- Implementation: Allow arithmetic and certain bitwise ops on AtomicPtr #96935
- atomic RMW intrinsics: avoid unnecessary ptr/int conversions #134617
- Final comment period (FCP)1
- Stabilization PR
Unresolved Questions
- Naming (some discussion at Rename
AtomicPtr::fetch_ptr_{add,sub}
toAtomicPtr::fetch_{add,sub}
libs-team#126)
Footnotes
stepancheg
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCI-libs-api-nominatedNominated for discussion during a libs-api team meeting.Nominated for discussion during a libs-api team meeting.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.disposition-mergeThis issue / PR is in PFCP or FCP with a disposition to merge it.This issue / PR is in PFCP or FCP with a disposition to merge it.proposed-final-comment-periodProposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off.