diff options
| author | Ralf Jung <post@ralfj.de> | 2018-11-06 11:10:03 +0100 |
|---|---|---|
| committer | Ralf Jung <post@ralfj.de> | 2018-11-07 16:54:31 +0100 |
| commit | b9a35dcb49dbc69b484bc97f807715c218a9ecbf (patch) | |
| tree | 442fc6ddda57172ded2e8387a7f9b45e8259634b | |
| parent | f27cd60ae1819b3b23fc8c3cb21d5f7d457014a1 (diff) | |
| download | rust-b9a35dcb49dbc69b484bc97f807715c218a9ecbf.tar.gz rust-b9a35dcb49dbc69b484bc97f807715c218a9ecbf.zip | |
calling the ptr hooks no longer needs expensive preparation, remove the opt-out
| -rw-r--r-- | src/librustc_mir/const_eval.rs | 1 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/machine.rs | 5 | ||||
| -rw-r--r-- | src/librustc_mir/interpret/place.rs | 18 |
3 files changed, 8 insertions, 16 deletions
diff --git a/src/librustc_mir/const_eval.rs b/src/librustc_mir/const_eval.rs index 011887090ee..cbcc6709c01 100644 --- a/src/librustc_mir/const_eval.rs +++ b/src/librustc_mir/const_eval.rs @@ -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 { diff --git a/src/librustc_mir/interpret/machine.rs b/src/librustc_mir/interpret/machine.rs index 214ffd071cc..55da12a68e3 100644 --- a/src/librustc_mir/interpret/machine.rs +++ b/src/librustc_mir/interpret/machine.rs @@ -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; diff --git a/src/librustc_mir/interpret/place.rs b/src/librustc_mir/interpret/place.rs index da62594cb22..d52250a43ac 100644 --- a/src/librustc_mir/interpret/place.rs +++ b/src/librustc_mir/interpret/place.rs @@ -290,16 +290,14 @@ where 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) } |
