miri::concurrency::data_race

Trait EvalContextPrivExt

Source
trait EvalContextPrivExt<'tcx>: MiriInterpCxExt<'tcx> {
    // Provided methods
    fn allow_data_races_ref<R>(
        &self,
        op: impl FnOnce(&MiriInterpCx<'tcx>) -> R,
    ) -> R { ... }
    fn allow_data_races_mut<R>(
        &mut self,
        op: impl FnOnce(&mut MiriInterpCx<'tcx>) -> R,
    ) -> R { ... }
    fn atomic_access_check(
        &self,
        place: &MPlaceTy<'tcx>,
        access_type: AtomicAccessType,
    ) -> InterpResult<'tcx> { ... }
    fn validate_atomic_load(
        &self,
        place: &MPlaceTy<'tcx>,
        atomic: AtomicReadOrd,
    ) -> InterpResult<'tcx> { ... }
    fn validate_atomic_store(
        &mut self,
        place: &MPlaceTy<'tcx>,
        atomic: AtomicWriteOrd,
    ) -> InterpResult<'tcx> { ... }
    fn validate_atomic_rmw(
        &mut self,
        place: &MPlaceTy<'tcx>,
        atomic: AtomicRwOrd,
    ) -> InterpResult<'tcx> { ... }
    fn validate_atomic_op<A: Debug + Copy>(
        &self,
        place: &MPlaceTy<'tcx>,
        atomic: A,
        access: AccessType,
        op: impl FnMut(&mut MemoryCellClocks, &mut ThreadClockSet, VectorIdx, A) -> Result<(), DataRace>,
    ) -> InterpResult<'tcx> { ... }
}

Provided Methods§

Source

fn allow_data_races_ref<R>( &self, op: impl FnOnce(&MiriInterpCx<'tcx>) -> R, ) -> R

Temporarily allow data-races to occur. This should only be used in one of these cases:

  • One of the appropriate validate_atomic functions will be called to treat a memory access as atomic.
  • The memory being accessed should be treated as internal state, that cannot be accessed by the interpreted program.
  • Execution of the interpreted program execution has halted.
Source

fn allow_data_races_mut<R>( &mut self, op: impl FnOnce(&mut MiriInterpCx<'tcx>) -> R, ) -> R

Same as allow_data_races_ref, this temporarily disables any data-race detection and so should only be used for atomic operations or internal state that the program cannot access.

Source

fn atomic_access_check( &self, place: &MPlaceTy<'tcx>, access_type: AtomicAccessType, ) -> InterpResult<'tcx>

Checks that an atomic access is legal at the given place.

Source

fn validate_atomic_load( &self, place: &MPlaceTy<'tcx>, atomic: AtomicReadOrd, ) -> InterpResult<'tcx>

Update the data-race detector for an atomic read occurring at the associated memory-place and on the current thread.

Source

fn validate_atomic_store( &mut self, place: &MPlaceTy<'tcx>, atomic: AtomicWriteOrd, ) -> InterpResult<'tcx>

Update the data-race detector for an atomic write occurring at the associated memory-place and on the current thread.

Source

fn validate_atomic_rmw( &mut self, place: &MPlaceTy<'tcx>, atomic: AtomicRwOrd, ) -> InterpResult<'tcx>

Update the data-race detector for an atomic read-modify-write occurring at the associated memory place and on the current thread.

Source

fn validate_atomic_op<A: Debug + Copy>( &self, place: &MPlaceTy<'tcx>, atomic: A, access: AccessType, op: impl FnMut(&mut MemoryCellClocks, &mut ThreadClockSet, VectorIdx, A) -> Result<(), DataRace>, ) -> InterpResult<'tcx>

Generic atomic operation implementation

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<'tcx> EvalContextPrivExt<'tcx> for MiriInterpCx<'tcx>