]> git.lizzy.rs Git - rust.git/commitdiff
calling the ptr hooks no longer needs expensive preparation, remove the opt-out
authorRalf Jung <post@ralfj.de>
Tue, 6 Nov 2018 10:10:03 +0000 (11:10 +0100)
committerRalf Jung <post@ralfj.de>
Wed, 7 Nov 2018 15:54:31 +0000 (16:54 +0100)
src/librustc_mir/const_eval.rs
src/librustc_mir/interpret/machine.rs
src/librustc_mir/interpret/place.rs

index 011887090eefe8002f3ffffc9b02f2ef415b718c..cbcc6709c0199c05b7f2270f6758c29b1f8459ad 100644 (file)
@@ -351,7 +351,6 @@ impl<'a, 'mir, 'tcx> interpret::Machine<'a, 'mir, 'tcx>
     type MemoryMap = FxHashMap<AllocId, (MemoryKind<!>, Allocation)>;
 
     const STATIC_KIND: Option<!> = None; // no copying of statics allowed
-    const ENABLE_PTR_TRACKING_HOOKS: bool = false; // we don't have no provenance
 
     #[inline(always)]
     fn enforce_validity(_ecx: &EvalContext<'a, 'mir, 'tcx, Self>) -> bool {
index 214ffd071cc9fb2b06b83e9aa4ec80a62cd25468..55da12a68e38550210c3896c2860829be31f5986 100644 (file)
@@ -95,11 +95,6 @@ pub trait Machine<'a, 'mir, 'tcx>: Sized {
     /// that is added to the memory so that the work is not done twice.
     const STATIC_KIND: Option<Self::MemoryKinds>;
 
-    /// As an optimization, you can prevent the pointer tracking hooks from ever being
-    /// called.  You should only do this if you do not care about provenance tracking.
-    /// This controls the `tag_reference` and `tag_dereference` hooks.
-    const ENABLE_PTR_TRACKING_HOOKS: bool;
-
     /// Whether to enforce the validity invariant
     fn enforce_validity(ecx: &EvalContext<'a, 'mir, 'tcx, Self>) -> bool;
 
index da62594cb22c01d12d2ce7b34fab97f711666386..d52250a43ac9f340c257de3928ef39f69425969d 100644 (file)
@@ -290,16 +290,14 @@ pub fn ref_to_mplace(
         let mplace = MemPlace { ptr, align, meta };
         let mut mplace = MPlaceTy { mplace, layout };
         // Pointer tag tracking might want to adjust the tag.
-        if M::ENABLE_PTR_TRACKING_HOOKS {
-            let mutbl = match val.layout.ty.sty {
-                // `builtin_deref` considers boxes immutable, that's useless for our purposes
-                ty::Ref(_, _, mutbl) => Some(mutbl),
-                ty::Adt(def, _) if def.is_box() => Some(hir::MutMutable),
-                ty::RawPtr(_) => None,
-                _ => bug!("Unexpected pointer type {}", val.layout.ty.sty),
-            };
-            mplace.mplace.ptr = M::tag_dereference(self, mplace, mutbl)?;
-        }
+        let mutbl = match val.layout.ty.sty {
+            // `builtin_deref` considers boxes immutable, that's useless for our purposes
+            ty::Ref(_, _, mutbl) => Some(mutbl),
+            ty::Adt(def, _) if def.is_box() => Some(hir::MutMutable),
+            ty::RawPtr(_) => None,
+            _ => bug!("Unexpected pointer type {}", val.layout.ty.sty),
+        };
+        mplace.mplace.ptr = M::tag_dereference(self, mplace, mutbl)?;
         // Done
         Ok(mplace)
     }