Add singlethreaded fence intrinsics.
These new intrinsics are comparable to `atomic_signal_fence` in C++, ensuring the compiler will not reorder memory accesses across the barrier, nor will it emit any machine instructions for it. Closes #24118, implementing RFC 888.
This commit is contained in:
@@ -139,6 +139,21 @@ extern "rust-intrinsic" {
|
||||
pub fn atomic_fence_rel();
|
||||
pub fn atomic_fence_acqrel();
|
||||
|
||||
/// A compiler-only memory barrier.
|
||||
///
|
||||
/// Memory accesses will never be reordered across this barrier by the compiler,
|
||||
/// but no instructions will be emitted for it. This is appropriate for operations
|
||||
/// on the same thread that may be preempted, such as when interacting with signal
|
||||
/// handlers.
|
||||
#[cfg(not(stage0))] // SNAP 5520801
|
||||
pub fn atomic_singlethreadfence();
|
||||
#[cfg(not(stage0))] // SNAP 5520801
|
||||
pub fn atomic_singlethreadfence_acq();
|
||||
#[cfg(not(stage0))] // SNAP 5520801
|
||||
pub fn atomic_singlethreadfence_rel();
|
||||
#[cfg(not(stage0))] // SNAP 5520801
|
||||
pub fn atomic_singlethreadfence_acqrel();
|
||||
|
||||
/// Aborts the execution of the process.
|
||||
pub fn abort() -> !;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user