Documentation

Miri.Interpreter.PlaceMachine

Canonical Place ↔ Miri machine access. Vector-clock and Tree Borrows rules are actual operations; address/global/weak-memory/synchronization policies are required leaves. Typed failures survive the legacy string memory-hook boundary.

@[reducible, inline]
Equations
Instances For
    @[reducible, inline]
    Equations
    Instances For
      Instances For

        Policies outside ordinary non-atomic VClock/Tree-Borrows access. Diagnostic runs before races; weakMemoryWrite after successful race write; syncAccess after successful Tree Borrows. Hooks may change User/external indices, not live bytes; the allocation-access layer owns byte/extra commits. Disabled policies must be chosen explicitly by the machine configuration.

        Instances For

          Source before_memory_read/write order, retaining the tree after access UB and prior clock/weak-memory effects on every failure.

          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
              • 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
                  • One or more equations did not get rendered due to their size.
                  Instances For
                    theorem Miri.Interpreter.PlaceMachine.writeMemory_zero_uninit {K User : Type} [DecidableEq K] (config : AccessConfig K User) (later : MemoryOperandLayout → Bool) (place : MPlaceTy Memory.Provenance) (pointer : Memory.Pointer (Option Memory.Provenance)) (ty : Option Nat) (pointerSize : ABI.Size) (unitLayout : localMemoryLayout place.layout = { size := ABI.Size.ZERO, align := ABI.Align.ONE, backendRepr := ABI.BackendRepr.Memory, canonicalType := ty }) (placeMemory : place.mplace = { ptr := pointer, metadata := MemPlaceMeta.none, misaligned := none }) (pointerMetadata : config.runtime.pointerSizeIn config.runtime.defaultAddressSpace = Except.ok pointerSize) (retain : ∀ (machine : Machine K User), config.retainTouched machine none = machine) (state : State K User) :
                    writeMemory config later Immediate.uninit place state = EStateM.Result.ok () state

                    The canonical zero-sized unit write preserves the entire machine and stack. No allocation lookup, pointer resolution or permission transition is assumed. The layout and pointer-size premises concern compiler/target data only.

                    Source stack init_allocation: root borrow tree before allocation race state. Stack allocation time comes from the active thread; historical local clocks are transferred by afterLocalMovedToMemory later. Span-only diagnostic and weak-memory construction leaves remain explicit.

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

                        Actual uninitialized stack allocation, with root/tree/clock effects retained when a later root-address adjustment fails.

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

                          Typed stack allocation retains the source sized-layout check. Raw temporary buffers use allocateStackRaw directly and require no fabricated compiler type.

                          Equations
                          • One or more equations did not get rendered due to their size.
                          Instances For
                            Instances For
                              def Miri.Interpreter.PlaceMachine.layoutLocal {K User C : Type} (compiler : CompilerHooks K User C) (choice : C) (id : MIR.LocalId) :
                              M K User LocalLayout
                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def Miri.Interpreter.PlaceMachine.localToOpCore {K User : Type} (layoutOf : MIR.LocalId → M K User LocalLayout) (validationInProgress : M K User Bool) (id : MIR.LocalId) :

                                Source local read, with layout/cache resolution provided separately from unrelated compiler/place operations. The actual read event remains mandatory.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  def Miri.Interpreter.PlaceMachine.localToOp {K User C : Type} (compiler : CompilerHooks K User C) (choice : C) (id : MIR.LocalId) :
                                  Equations
                                  • One or more equations did not get rendered due to their size.
                                  Instances For
                                    def Miri.Interpreter.PlaceMachine.placeHooks {K User C : Type} [DecidableEq K] (access : AccessConfig K User) (allocation : AllocationConfig K User) (compiler : CompilerHooks K User C) :
                                    Equations
                                    • One or more equations did not get rendered due to their size.
                                    Instances For

                                      Compiler/type/layout preparation remains fallible; the write-uninit stage is supplied by the actual typed memory writer below, including races and TB.

                                      Instances For
                                        def Miri.Interpreter.PlaceMachine.retagHooks {K User : Type} [DecidableEq K] (access : AccessConfig K User) (queries : RetagQueries K User) :
                                        Equations
                                        • One or more equations did not get rendered due to their size.
                                        Instances For
                                          def Miri.Interpreter.PlaceMachine.bindRvalue {K User C : Type} [DecidableEq K] (base : RvalueHooks Memory.Provenance (State K User) C (RuntimePlace Memory.Provenance)) (access : AccessConfig K User) (allocation : AllocationConfig K User) (compiler : CompilerHooks K User C) (queries : RetagQueries K User) (copy : PlaceCopyHooks Memory.Provenance (State K User) C) (evaluatePlace : C → MIR.Place → Bool → M K User (RuntimePlace Memory.Provenance)) :

                                          Bind canonical typed places and actual retag/race hooks to the existing rvalue interpreter. The supplied evaluator is normally PlaceDynamic.evalPlace; operand evaluation/projection, casts and compiler facts stay required in base. No unconditional retag is inserted on raw-pointer or integer copies: the source rvalue dispatcher chooses Default/TwoPhase/Raw/None and its retag trigger.

                                          Equations
                                          • One or more equations did not get rendered due to their size.
                                          Instances For
                                            theorem Miri.Interpreter.PlaceMachine.memoryAccess_fresh_write {K User : Type} (config : AccessConfig K User) (machine : Machine K User) (id : Memory.AllocId) (tag : Memory.BorTag) (size : ABI.Size) (noClocks : machine.dataRace = none) (diagnostic : config.diagnostic true id (Memory.allocRange ABI.Size.ZERO size) machine = EStateM.Result.ok () machine) (weak : config.weakMemoryWrite id (Memory.allocRange ABI.Size.ZERO size) machine = EStateM.Result.ok () machine) (sync : config.syncAccess true id (Memory.allocRange ABI.Size.ZERO size) machine = EStateM.Result.ok () machine) :
                                            memoryAccess config true { machine := machine } (TreeBorrows.BorrowTree.new tag size) id (Memory.ProvenanceExtra.concrete tag) (Memory.allocRange ABI.Size.ZERO size) = { state := { machine := machine }, extra := TreeBorrows.BorrowTree.new tag size, outcome := Except.ok () }

                                            Internal stage composition for the fresh allocation's first whole write. The caller discharges diagnostic/weak/sync edges from the current raw machine.

                                            theorem Miri.Interpreter.PlaceMachine.resolvePointer_ok {K User : Type} (config : AccessConfig K User) (memory : Memory.MemoryState Memory.Provenance TreeBorrows.BorrowTree K) (machine : Machine K User) (pointer : Memory.Pointer (Option Memory.Provenance)) (amount : Int) (result : Except UInt64 (Memory.ResolvedPointer Memory.ProvenanceExtra)) (resolved : config.resolvePointer memory pointer amount machine = EStateM.Result.ok result machine) :
                                            (accessHooks config).resolvePointer memory { machine := machine } pointer amount = { state := { machine := machine }, outcome := Except.ok result }

                                            An internal exact resolver equation lifted through the production bridge.

                                            theorem Miri.Interpreter.PlaceMachine.writeMemory_of_result {K User : Type} [DecidableEq K] (config : AccessConfig K User) (later : MemoryOperandLayout → Bool) (value : Immediate Memory.Provenance) (place : MPlaceTy Memory.Provenance) (state : State K User) (memory : Memory.MemoryState Memory.Provenance TreeBorrows.BorrowTree K) (touched : Option (Memory.AllocationAccessRef Memory.Provenance TreeBorrows.BorrowTree)) (retain : config.retainTouched = fun (machine : Machine K User) (x : Option (Memory.AllocationAccessRef Memory.Provenance TreeBorrows.BorrowTree)) => machine) (operand : writeImmediateToMplaceNoValidate state.machine.memory { machine := state.machine } value { mplace := place.mplace, layout := localMemoryLayout place.layout } config.runtime config.ghostMode config.globalKind config.globalHooks (accessHooks config) config.dynamicLayout later = { memory := memory, hooks := { machine := state.machine }, touched := touched, outcome := Except.ok () }) :
                                            writeMemory config later value place state = EStateM.Result.ok () { stack := state.stack, machine := have __src := state.machine; { memory := memory, borrowTracker := __src.borrowTracker, dataRace := __src.dataRace, threads := __src.threads, raceAllocations := __src.raceAllocations, allocationSpans := __src.allocationSpans, user := __src.user } }

                                            Commit a successful actual operand mutation through the production memory writer; every stack/user field outside memory is retained exactly.