about summary refs log tree commit diff
diff options
context:
space:
mode:
authorRalf Jung <post@ralfj.de>2018-10-05 10:23:39 +0200
committerRalf Jung <post@ralfj.de>2018-10-10 09:58:17 +0200
commit03545109f46a564ac21771125c036332d5b95bb1 (patch)
treef5718f90e1d3cbdc3680d9ff5ff70e8fddf0a1ec
parente0b17ad26cd31d3f40bb00c993eafd7be458b588 (diff)
downloadrust-03545109f46a564ac21771125c036332d5b95bb1.tar.gz
rust-03545109f46a564ac21771125c036332d5b95bb1.zip
clarify alloc_map description
-rw-r--r--src/librustc_mir/interpret/memory.rs10
1 files 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<AllocId, (MemoryKind<M::MemoryKinds>, Allocation<M::PointerTag>)>,
 
     /// To be able to compare pointers with NULL, and to check alignment for accesses