Documentation

Miri.Concurrency.AtomicScalarMemory

Scalar memory operations around Miri's atomic hooks #

This is the concrete scalar-storage layer for one live allocation when the allocation has no borrow-tracker or synchronization-object payload. It uses the pinned rustc Allocation.read_scalar/write_scalar transitions and then the Miri clock/store-buffer hooks in AtomicDispatch, in source order. The allocation's Extra is Unit, so this module cannot represent a Miri allocation with active borrow tracking or synchronization objects. Callers must not treat this restricted slice as a complete interpreter execution.

atomicAccessCheck (place alignment, allocation resolution and read-only rules), interpreter before_memory_* hooks and diagnostics are outside this module. The concrete Miri path performs before_memory_* while ongoing_action_data_race_free is set, so this module mirrors that flag window around byte access; it does not claim to run the absent borrow/sync hooks. Every operation here is therefore a component of the dispatch, not a Miri program-safety result.

Scalar state for one allocation's interpreter bytes and its exact allocation-local data-race/store-buffer state.

Instances For

    Failures from the concrete scalar-storage and clock/buffer stages.

    Instances For
      Equations
      • One or more equations did not get rendered due to their size.
      Instances For

        Outcome always carries the post-operation byte and concurrency state, including write errors after source-ordered partial allocation mutation. The nonempty requiredHooks field prevents the scalar/data-race fragment from being mistaken for a complete interpreter dispatch.

        Instances For
          Equations
          • One or more equations did not get rendered due to their size.
          Instances For
            Instances For

              A component error or uncompleted interpreter hook is an obligation, not a successful terminal result. This adapter deliberately has no UB judgement: classification requires the actual interpreter hooks and diagnostics.

              Instances For
                Equations
                • One or more equations did not get rendered due to their size.
                Instances For

                  Interpret this component's state as an operational-safety outcome. Since its access-check and memory-hook obligations have not been discharged by this module, successful scalar/clock work remains blocked; it cannot establish Safe merely because the component returned a value.

                  Equations
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    def Miri.Concurrency.atomicScalarLoad {Prov : Type} [DecidableEq Prov] [Memory.PointerProvenance Prov] (state : AtomicScalarMemory Prov) (threads : ThreadManager) (layout : ABI.TargetDataLayout) (range : Memory.AllocRange) (readProvenance : Bool) (ordering : AtomicReadOrd) (choiceRank : Nat) :

                    The scalar-memory and buffered-clock implementation of the body after atomic_access_check in read_scalar_atomic. It reads the actual latest allocation scalar first, then delegates legal finite read choices and their validation/metadata order to bufferedAtomicRead. choiceRank is an explicit member of the exact source candidate set, not a random seed.

                    Equations
                    • One or more equations did not get rendered due to their size.
                    Instances For
                      def Miri.Concurrency.atomicScalarStore {Prov : Type} [DecidableEq Prov] [Memory.PointerProvenance Prov] (state : AtomicScalarMemory Prov) (threads : ThreadManager) (layout : ABI.TargetDataLayout) (range : Memory.AllocRange) (readProvenance : Bool) (value : Memory.Scalar Prov) (ordering : AtomicWriteOrd) :

                      Source write_scalar_atomic's local path for the actual allocation and VClock weak-memory backend. The old scalar is a best-effort ghost read: its failure becomes an uninitialized initial store, as in Miri. The real write happens before validate_atomic_store; its memory mutation remains present if validation later fails.

                      Equations
                      • One or more equations did not get rendered due to their size.
                      Instances For

                        The supported source AtomicRmwOp forms. These mirror the cases used by rustc's atomic intrinsics: arithmetic/bitwise MIR operations, signedness-aware min/max, and scalar swap.

                        Instances For
                          Equations
                          Instances For
                            Equations
                            • One or more equations did not get rendered due to their size.
                            Instances For

                              Result of the integer or thin-pointer compare-exchange path.

                              Instances For
                                def Miri.Concurrency.atomicScalarRmw {Prov : Type} [DecidableEq Prov] [Memory.PointerProvenance Prov] (state : AtomicScalarMemory Prov) (threads : ThreadManager) (layout : ABI.TargetDataLayout) (range : Memory.AllocRange) (readProvenance : Bool) (operation : AtomicRmwScalarOp) (integerType : Interpreter.IntegerType) (rhs : Memory.Scalar Prov) (ordering : AtomicRwOrd) :

                                Source atomic_rmw's local scalar path: checked scalar read, exact MIR operator calculation, byte/provenance write, atomic RMW validation, then the store-buffer read of the last modification followed by append.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  def Miri.Concurrency.atomicScalarCompareExchange {Prov : Type} [DecidableEq Prov] [Memory.PointerProvenance Prov] (state : AtomicScalarMemory Prov) (threads : ThreadManager) (layout : ABI.TargetDataLayout) (range : Memory.AllocRange) (readProvenance : Bool) (integerType : Interpreter.IntegerType) (expected newValue : Memory.Scalar Prov) (canFailSpuriously spuriousFailureChosen : Bool) (successOrdering : AtomicRwOrd) (failureOrdering : AtomicReadOrd) :

                                  The integer and thin-pointer branches of atomic_compare_exchange. For weak CAS, spuriousFailureChosen is the explicit outcome selected from the source RNG; it only changes an otherwise-successful comparison. On failure, validation is an atomic load followed by perform_read_on_buffered_latest; on success, the new scalar is written before atomic-RMW validation and buffered-RMW metadata.

                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For