From 03545109f46a564ac21771125c036332d5b95bb1 Mon Sep 17 00:00:00 2001 From: Ralf Jung Date: Fri, 5 Oct 2018 10:23:39 +0200 Subject: [PATCH] clarify alloc_map description --- src/librustc_mir/interpret/memory.rs | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/librustc_mir/interpret/memory.rs b/src/librustc_mir/interpret/memory.rs index 4478c29dd08..995c8a3568a 100644 --- a/src/librustc_mir/interpret/memory.rs +++ b/src/librustc_mir/interpret/memory.rs @@ -52,10 +52,12 @@ pub struct Memory<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'a, 'mir, 'tcx>> { /// Allocations local to this instance of the miri engine. The kind /// helps ensure that the same mechanism is used for allocation and /// deallocation. When an allocation is not found here, it is a - /// static and looked up in the `tcx` for read access. Writing to - /// a static creates a copy here, in the machine. - /// We have this in a RefCell to be able to cache when a new allocation - /// for a static has to be created on a read access. + /// static and looked up in the `tcx` for read access. If this machine + /// does pointer provenance tracking, the type of alloctions in `tcx` + /// and here do not match, so we have a `MonoHashMap` to be able to + /// put the "mapped" allocation into `alloc_map` even on a read access. + /// Either way, if the machine allows writing to a static, doing so will + /// create a copy of the static allocation here. alloc_map: MonoHashMap, Allocation)>, /// To be able to compare pointers with NULL, and to check alignment for accesses