Bounds-checked allocation access from pinned interpreter memory.rs. Actual global materialization precedes bounds checking. Machine access hooks remain explicit, and retain updated allocation extras even when they fail. These helpers do not check alignment or perform byte loads/stores.
- resolvePointer : MemoryState Prov Extra MachineKind → HookState → Pointer (Option Prov) → Int → MachineHookResult HookState (Except UInt64 (ResolvedPointer ProvExtra))
Outer error means unavailable machine semantics; inner error is the source's integer address that could not be resolved.
- beforeAllocationAccess : HookState → AllocId → MachineHookResult HookState Unit
- beforeMemoryRead : HookState → Extra → Pointer (Option Prov) → AllocId → ProvExtra → AllocRange → AllocationExtraHookResult HookState Extra
- beforeMemoryWrite : HookState → Extra → Pointer (Option Prov) → AllocId → ProvExtra → AllocRange → AllocationExtraHookResult HookState Extra
Instances For
- allocId : AllocId
- range : AllocRange
- allocation : Allocation Prov Extra
Instances For
- access (reason : AccessError) : PtrAllocationError
- rawAccess (reason : MemoryAccessError) : PtrAllocationError
- hookFailure (hook message : String) : PtrAllocationError
- cacheUpdate (reason : AllocationLookupError) : PtrAllocationError
Instances For
@[instance_reducible]
Equations
- One or more equations did not get rendered due to their size.
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.access a) (Miri.Memory.PtrAllocationError.access b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.access reason) (Miri.Memory.PtrAllocationError.rawAccess reason_1) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.access reason) (Miri.Memory.PtrAllocationError.hookFailure hook message) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.access reason) (Miri.Memory.PtrAllocationError.cacheUpdate reason_1) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.rawAccess reason) (Miri.Memory.PtrAllocationError.access reason_1) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.rawAccess a) (Miri.Memory.PtrAllocationError.rawAccess b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.rawAccess reason) (Miri.Memory.PtrAllocationError.hookFailure hook message) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.rawAccess reason) (Miri.Memory.PtrAllocationError.cacheUpdate reason_1) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.hookFailure hook message) (Miri.Memory.PtrAllocationError.access reason) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.hookFailure hook message) (Miri.Memory.PtrAllocationError.rawAccess reason) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.hookFailure hook message) (Miri.Memory.PtrAllocationError.cacheUpdate reason) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.cacheUpdate reason) (Miri.Memory.PtrAllocationError.access reason_1) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.cacheUpdate reason) (Miri.Memory.PtrAllocationError.rawAccess reason_1) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.cacheUpdate reason) (Miri.Memory.PtrAllocationError.hookFailure hook message) = isFalse ⋯
- Miri.Memory.instDecidableEqPtrAllocationError.decEq (Miri.Memory.PtrAllocationError.cacheUpdate a) (Miri.Memory.PtrAllocationError.cacheUpdate b) = if h : a = b then h ▸ isTrue ⋯ else isFalse ⋯
Instances For
Equations
- One or more equations did not get rendered due to their size.
Instances For
@[instance_reducible]
Equations
- memory : MemoryState Prov Extra MachineKind
- hooks : HookState
- touched : Option (AllocationAccessRef Prov Extra)
Snapshot also retained on failure for borrowed global allocation extras. Miri-owned allocations are simultaneously updated in
memory.live. - outcome : Except PtrAllocationError α
Instances For
def
Miri.Memory.AllocationAccess.getPtrAlloc
{Prov Extra MachineKind HookState ProvExtra : Type}
[DecidableEq MachineKind]
(memory : MemoryState Prov Extra MachineKind)
(hooksState : HookState)
(target : PointerArithmetic)
(ptr : Pointer (Option Prov))
(size : ABI.Size)
(ghostMode : Bool)
(globalKind : Option MachineKind)
(globalHooks : GlobalAllocationHooks Prov Extra MachineKind HookState)
(accessHooks : AllocationAccessHooks Prov Extra MachineKind HookState ProvExtra)
:
PtrAllocationResult Prov Extra MachineKind HookState (Option (AllocationAccessRef Prov Extra))
Equations
- One or more equations did not get rendered due to their size.
Instances For
def
Miri.Memory.AllocationAccess.getPtrAllocMut
{Prov Extra MachineKind HookState ProvExtra : Type}
[DecidableEq MachineKind]
(memory : MemoryState Prov Extra MachineKind)
(hooksState : HookState)
(target : PointerArithmetic)
(ptr : Pointer (Option Prov))
(size : ABI.Size)
(ghostMode : Bool)
(globalKind : Option MachineKind)
(globalHooks : GlobalAllocationHooks Prov Extra MachineKind HookState)
(accessHooks : AllocationAccessHooks Prov Extra MachineKind HookState ProvExtra)
:
PtrAllocationResult Prov Extra MachineKind HookState (Option (AllocationAccessRef Prov Extra))
Equations
- One or more equations did not get rendered due to their size.
Instances For
theorem
Miri.Memory.AllocationAccess.live_mut_of_edges
{P E K H X : Type}
[DecidableEq K]
(memory : MemoryState P E K)
(hooks : H)
(target : PointerArithmetic)
(ptr : Pointer (Option P))
(size : ABI.Size)
(kind : Option K)
(global : GlobalAllocationHooks P E K H)
(access : AllocationAccessHooks P E K H X)
(id : AllocId)
(entry : LocalAllocation P E K)
(provenance : X)
(amount : Int)
(signed : sizeAsI64 size = Except.ok amount)
(nonzero : amount ≠ 0)
(resolve :
access.resolvePointer memory hooks ptr amount = { state := hooks,
outcome := Except.ok (Except.ok { allocId := id, offset := ABI.Size.ZERO, extra := provenance }) })
(live : Array.find? (fun (row : AllocId × LocalAllocation P E K) => row.fst == id) memory.live = some (id, entry))
(mutable : entry.allocation.mutability = Mutability.Mut)
(synchronize : global.synchronizeMemory memory hooks = hooks)
(bounds :
checkedBounds target id entry.allocation.byteSize ABI.Size.ZERO amount CheckInAllocMsg.memoryAccess = Except.ok ())
(before : access.beforeAllocationAccess hooks id = { state := hooks, outcome := Except.ok () })
(write :
access.beforeMemoryWrite hooks entry.allocation.extra ptr id provenance (allocRange ABI.Size.ZERO size) = { state := hooks, extra := entry.allocation.extra, outcome := Except.ok () })
(last :
(Array.filter (fun (row : AllocId × LocalAllocation P E K) => row.fst != id) memory.live).push (id, entry) = memory.live)
:
getPtrAllocMut memory hooks target ptr size false kind global access = { memory := memory, hooks := hooks,
touched := some { allocId := id, range := allocRange ABI.Size.ZERO size, allocation := entry.allocation },
outcome :=
Except.ok (some { allocId := id, range := allocRange ABI.Size.ZERO size, allocation := entry.allocation }) }
Internal edges compose the production positive mutable-access path.