Documentation

Miri.TreeBorrows.MachineMemoryHooks

Tree Borrows adapters for the three Miri Machine memory hooks.

The caller order in pinned machine.rs is represented here: optional allocation diagnostics, data-race handling, Tree Borrows, synchronization objects, and (for deallocation) span/address-map release. The data-race, sync-object, diagnostic, span, and allocation-ID operations remain callbacks; this module does not pretend to implement those machine subsystems. Read and write adapters update the live allocation's BorrowTree extra before returning a Tree Borrows failure, as the source mutates AllocExtra in place.

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

        A finite ordered representation of Miri's per-allocation BTreeMap<Size, Box<dyn SyncObj>>. Insertion keeps keys unique and ascending, so the access walks below have the source map's iteration order.

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

                Allocation-indexed sync metadata. Miri stores one offset map inside each AllocExtra; this outer index lets a single mem_copy_repeatedly context carry the source and destination allocation maps independently.

                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

                        The AllocExtra-local sync map plus the global state threaded through Miri's machine callbacks. The caller supplies the sync map for the allocation currently being accessed and stores the returned map with that allocation.

                        Instances For
                          structure Miri.TreeBorrows.MachineMemoryHooks.Hooks (State Obj MachineKind : Type) :

                          Hooks corresponding to the portions of machine.rs and concurrency::sync::SyncObj outside the Tree Borrows subtree. Data-race hooks must dispatch the configured Miri handler (None or vector clocks), including its per-allocation-handler invariant and weak-memory write effect.

                          Instances For
                            structure Miri.TreeBorrows.MachineMemoryHooks.AccessResult (State Obj MachineKind : Type) :
                            Instances For
                              def Miri.TreeBorrows.MachineMemoryHooks.beforeMemoryRead {MachineKind State Obj : Type} [DecidableEq MachineKind] (memory : Memory.MemoryState Memory.Provenance BorrowTree MachineKind) (context : Context State Obj) (hooks : Hooks State Obj MachineKind) (allocation : Memory.Allocation Memory.Provenance BorrowTree) (pointer : Memory.Pointer (Option Memory.Provenance)) (allocId : Memory.AllocId) (provenance : Memory.ProvenanceExtra) (range : Memory.AllocRange) :
                              AccessResult State Obj MachineKind

                              Pinned MiriMachine::before_memory_read after optional diagnostic. The data-race hook runs first. The actual live allocation extra is then updated by the Tree Borrows access, and a Tree error prevents all sync-object callbacks.

                              Equations
                              • One or more equations did not get rendered due to their size.
                              Instances For
                                def Miri.TreeBorrows.MachineMemoryHooks.beforeMemoryWrite {MachineKind State Obj : Type} [DecidableEq MachineKind] (memory : Memory.MemoryState Memory.Provenance BorrowTree MachineKind) (context : Context State Obj) (hooks : Hooks State Obj MachineKind) (allocation : Memory.Allocation Memory.Provenance BorrowTree) (pointer : Memory.Pointer (Option Memory.Provenance)) (allocId : Memory.AllocId) (provenance : Memory.ProvenanceExtra) (range : Memory.AllocRange) :
                                AccessResult State Obj MachineKind

                                Pinned MiriMachine::before_memory_write after optional diagnostic. Sync objects are deleted only after every overlapping object's write check succeeds, matching the source's collect-then-remove loop.

                                Equations
                                • One or more equations did not get rendered due to their size.
                                Instances For
                                  Instances For
                                    def Miri.TreeBorrows.MachineMemoryHooks.beforeMemoryDeallocation {State Obj MachineKind : Type} (context : Context State Obj) (hooks : Hooks State Obj MachineKind) (allocation : Memory.Allocation Memory.Provenance BorrowTree) (pointer : Memory.Pointer (Option Memory.Provenance)) (allocId : Memory.AllocId) (provenance : Memory.ProvenanceExtra) (size : ABI.Size) (align : ABI.Align) (kind : Memory.MemoryKind MachineKind) :
                                    DeallocationResult State Obj MachineKind

                                    Pinned MiriMachine::before_memory_deallocation. MemoryLifecycle.deallocatePtr has already removed the allocation from its live map when it invokes this callback. The tree result is retained in allocation for callers that need to inspect a failed hook; the lifecycle caller still preserves its source removal on failure.

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

                                      Adapt the source-ordered Tree Borrows hooks to the existing mem_copy read/write callback boundary. Pointer resolution, before_alloc_access, and the actual Miri data-race handler remain explicit caller inputs.

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

                                        Adapt the ordered tree/race/sync/free sequence to MemoryLifecycleHooks.beforeDeallocation. The surrounding lifecycle owns pointer resolution, live-map removal, and dead-allocation caching; the adapter returns the explicit memory successor unchanged.

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