Documentation

Miri.TreeBorrows.GlobalState

Global pointer-tag and protector bookkeeping from Miri's borrow_tracker::GlobalStateInner, FrameState, and ProtectorKind.

This is the borrow-tracker bookkeeping layer only. Allocation tree mutations, protector-triggered reads on stack pop, and memory accesses live in separate Tree Borrows operations.

Miri's two protector strengths.

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

      Finite map from source BorTag to ProtectorKind.

      The source uses an FxHashMap, whose iteration order is not semantic here. This representation preserves the observable map operations (insert replaces, remove deletes, lookup returns the current kind).

      Instances For
        Equations
        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
                @[simp]

                Tags protected by one call frame, paired with the allocation whose Tree Borrows state must receive its release operation before the frame ends.

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

                        Provenance pairs visited by the source VisitProvenance implementation. The global protected-tag table is intentionally not separately traced.

                        Equations
                        Instances For
                          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 semantic fields from Miri's GlobalStateInner that govern pointer tag allocation and protector bookkeeping. Root allocation IDs and tracked tag IDs use arrays as finite maps/sets; their insertion and lookup behavior matches the source's map/set API.

                                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
                                      Instances For

                                        Source GlobalStateInner::new_ptr: return the current tag and advance the counter with checked BorTag::succ. Miri unwraps overflow; this port retains it as an explicit error.

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

                                          Source root_ptr_tag: return the stable per-allocation root tag, creating one with new_ptr when absent.

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

                                            Source remove_unreachable_allocs, where liveAllocIds is the set passed by the allocation collector.

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

                                              Add the two source-side records created when a reborrow installs a protector: one frame-owned (allocation, tag) pair and one global tag-to-kind entry used by access transitions.

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

                                                Source end_call: remove every tag listed by the frame from the global protected-tag map. Tree Borrows' release operation is performed before this bookkeeping step by on_stack_pop.

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

                                                  The global map is only a lookup index; protected tags remain live through their frame-owned provenance records.

                                                  Equations
                                                  • One or more equations did not get rendered due to their size.
                                                  Instances For
                                                    @[simp]
                                                    theorem Miri.TreeBorrows.GlobalState.newPointerTag_returns_one :
                                                    new.newPointerTag = Except.ok (have __src := new; { nextPointerTag := { value := 2, nonzero := ⋯ }, rootPointerTags := __src.rootPointerTags, protectedTags := __src.protectedTags, trackedPointerTags := __src.trackedPointerTags }, Memory.BorTag.one)
                                                    @[simp]
                                                    theorem Miri.TreeBorrows.GlobalState.rootPointerTag_existing (state : GlobalState) (allocId : Memory.AllocId) (tag : Memory.BorTag) (h : state.rootTag? allocId = some tag) :
                                                    state.rootPointerTag allocId = Except.ok (state, tag)
                                                    @[simp]
                                                    theorem Miri.TreeBorrows.GlobalState.addProtector_global_lookup (state : GlobalState) (frame : FrameState) (allocId : Memory.AllocId) (tag : Memory.BorTag) (kind : ProtectorKind) :
                                                    (state.addProtector frame allocId tag kind).fst.protectedTags.get tag = some kind