Atomic intrinsic ordering and access checks #
This module ports the ordered pre-memory portion of Miri's atomic path:
machine.rs converts intrinsic orderings before calling the atomic operation,
and data_race.rs::atomic_access_check derives the required alignment from
the access size, checks it, resolves allocation identity, then applies the
read-only-memory rules. The pointer resolver, machine alignment policy, live
allocation lookup, and mutability lookup are explicit callbacks because they
belong to the concrete interpreter state.
This does not perform a scalar load/store, RMW calculation, bounds/permission hook, or the later race-clock and store-buffer updates. Callers pass callbacks closed over the actual place and must invoke this check before those effects, matching Miri's source order.
The access class tested by atomic_access_check.
- load (ordering : AtomicReadOrd) : AtomicAccessKind
- store : AtomicAccessKind
- rmw : AtomicAccessKind
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Miri.Concurrency.instDecidableEqAtomicAccessKind.decEq (Miri.Concurrency.AtomicAccessKind.load a) (Miri.Concurrency.AtomicAccessKind.load b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessKind.decEq (Miri.Concurrency.AtomicAccessKind.load ordering) Miri.Concurrency.AtomicAccessKind.store = isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessKind.decEq (Miri.Concurrency.AtomicAccessKind.load ordering) Miri.Concurrency.AtomicAccessKind.rmw = isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessKind.decEq Miri.Concurrency.AtomicAccessKind.store (Miri.Concurrency.AtomicAccessKind.load ordering) = isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessKind.decEq Miri.Concurrency.AtomicAccessKind.store Miri.Concurrency.AtomicAccessKind.store = isTrue ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessKind.decEq Miri.Concurrency.AtomicAccessKind.rmw (Miri.Concurrency.AtomicAccessKind.load ordering) = isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessKind.decEq Miri.Concurrency.AtomicAccessKind.rmw Miri.Concurrency.AtomicAccessKind.rmw = isTrue ⋯
Instances For
Equations
Equations
- One or more equations did not get rendered due to their size.
Instances For
The first read-only-memory restriction selected by the source match.
- storeOrRmw : ReadOnlyAtomicViolation
- oversizedLoad : ReadOnlyAtomicViolation
- nonRelaxedLoad : ReadOnlyAtomicViolation
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Failures from the source-owned stages of atomic_access_check. The
alignment-construction and allocation-expectation variants record the pinned
Rust unwrap/expect boundaries; they are never treated as successful
accesses.
- alignmentConstructionPanic {PointerError MutabilityError : Type} (reason : ABI.AlignError) : AtomicAccessError PointerError MutabilityError
- pointerAlignment {PointerError MutabilityError : Type} (reason : PointerError) : AtomicAccessError PointerError MutabilityError
- allocationExpectationPanic {PointerError MutabilityError : Type} (reason : PointerError) : AtomicAccessError PointerError MutabilityError
- mutabilityLookup {PointerError MutabilityError : Type} (reason : MutabilityError) : AtomicAccessError PointerError MutabilityError
- undefinedBehavior {PointerError MutabilityError : Type} (violation : ReadOnlyAtomicViolation) : AtomicAccessError PointerError MutabilityError
Instances For
Equations
- One or more equations did not get rendered due to their size.
- Miri.Concurrency.instDecidableEqAtomicAccessError.decEq (Miri.Concurrency.AtomicAccessError.pointerAlignment reason) (Miri.Concurrency.AtomicAccessError.mutabilityLookup reason_1) = isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessError.decEq (Miri.Concurrency.AtomicAccessError.pointerAlignment reason) (Miri.Concurrency.AtomicAccessError.undefinedBehavior violation) = isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessError.decEq (Miri.Concurrency.AtomicAccessError.mutabilityLookup reason) (Miri.Concurrency.AtomicAccessError.pointerAlignment reason_1) = isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessError.decEq (Miri.Concurrency.AtomicAccessError.mutabilityLookup reason) (Miri.Concurrency.AtomicAccessError.undefinedBehavior violation) = isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessError.decEq (Miri.Concurrency.AtomicAccessError.undefinedBehavior violation) (Miri.Concurrency.AtomicAccessError.pointerAlignment reason) = isFalse ⋯
- Miri.Concurrency.instDecidableEqAtomicAccessError.decEq (Miri.Concurrency.AtomicAccessError.undefinedBehavior violation) (Miri.Concurrency.AtomicAccessError.mutabilityLookup reason) = isFalse ⋯
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Interpreter-owned callbacks used by the source atomic access check.
pointerTryGetAllocId is the ptr_try_get_alloc_id(ptr, 0) operation. Its
address error is kept distinct because the pinned source immediately calls
expect on this result.
- pointerTryGetAllocId : Except PointerError AllocId
- getAllocMutability : AllocId → Except MutabilityError Memory.Mutability
Instances For
Port of atomic_access_check after its concrete MPlace callbacks are
supplied. The order is size-to-alignment conversion, pointer alignment,
allocation identity, mutability lookup, and the ordered read-only rules.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Errors before an atomic operation reaches its place access check. Invalid read/write/fence orderings correspond to the pinned conversion panics and are kept explicit rather than weakened.
- invalidOrdering {PointerError MutabilityError : Type} (reason : AtomicOrderingError) : AtomicIntrinsicError PointerError MutabilityError
- accessCheck {PointerError MutabilityError : Type} (reason : AtomicAccessError PointerError MutabilityError) : AtomicIntrinsicError PointerError MutabilityError
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
Equations
Machine atomic_load: ordering conversion precedes the access check.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Machine atomic_store: ordering conversion precedes the access check.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Machine atomic_rmw: its ordering conversion accepts every ordering, then
the shared atomic access check runs before the interpreter reads memory.
Equations
- One or more equations did not get rendered due to their size.
Instances For
Machine compare-exchange converts the success ordering, then the failure
read ordering, before atomic_compare_exchange performs its access check.
Equations
- One or more equations did not get rendered due to their size.
Instances For
A single-thread fence is a source NOP and skips ordering conversion. A
multithread fence uses the checked AtomicFenceOrd::from conversion.
Equations
- Miri.Concurrency.prepareAtomicFence ordering singlethread = if singlethread = true then Except.ok none else Except.map some (Miri.Concurrency.AtomicFenceOrd.ofOrdering ordering)