about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDylan MacKenzie <ecstaticmorse@gmail.com>2018-06-24 12:51:49 -0700
committerDylan MacKenzie <ecstaticmorse@gmail.com>2018-07-04 14:36:07 -0700
commit10f217159b7ee7492fceb369aab179110affe2db (patch)
tree5a7dba07c659951b5ba1b57005a2d71489610f4a
parentc6aea935cf70bb79ed88dc891b517fc5130ab398 (diff)
downloadrust-10f217159b7ee7492fceb369aab179110affe2db.tar.gz
rust-10f217159b7ee7492fceb369aab179110affe2db.zip
Rename `bloom` to `hashes`
-rw-r--r--src/librustc_mir/interpret/eval_context.rs16
-rw-r--r--src/librustc_mir/interpret/step.rs4
2 files changed, 10 insertions, 10 deletions
diff --git a/src/librustc_mir/interpret/eval_context.rs b/src/librustc_mir/interpret/eval_context.rs
index 3375b6edf1a..020abbf94c5 100644
--- a/src/librustc_mir/interpret/eval_context.rs
+++ b/src/librustc_mir/interpret/eval_context.rs
@@ -148,14 +148,14 @@ type EvalSnapshot<'a, 'mir, 'tcx, M>
 pub(crate) struct InfiniteLoopDetector<'a, 'mir, 'tcx: 'a + 'mir, M: Machine<'mir, 'tcx>> {
     /// The set of all `EvalSnapshot` *hashes* observed by this detector.
     ///
-    /// Not a proper bloom filter.
-    bloom: FxHashSet<u64>,
+    /// When a collision occurs in this table, we store the full snapshot in `snapshots`.
+    hashes: FxHashSet<u64>,
 
     /// The set of all `EvalSnapshot`s observed by this detector.
     ///
-    /// An `EvalSnapshot` will only be fully cloned once it has caused a collision
-    /// in `bloom`. As a result, the detector must observe *two* full cycles of
-    /// an infinite loop before it triggers.
+    /// An `EvalSnapshot` will only be fully cloned once it has caused a collision in `hashes`. As
+    /// a result, the detector must observe at least *two* full cycles of an infinite loop before
+    /// it triggers.
     snapshots: FxHashSet<EvalSnapshot<'a, 'mir, 'tcx, M>>,
 }
 
@@ -165,7 +165,7 @@ impl<'a, 'mir, 'tcx, M> Default for InfiniteLoopDetector<'a, 'mir, 'tcx, M>
 {
     fn default() -> Self {
         InfiniteLoopDetector {
-            bloom: FxHashSet::default(),
+            hashes: FxHashSet::default(),
             snapshots: FxHashSet::default(),
         }
     }
@@ -177,7 +177,7 @@ impl<'a, 'mir, 'tcx, M> InfiniteLoopDetector<'a, 'mir, 'tcx, M>
 {
     /// Returns `true` if the loop detector has not yet observed a snapshot.
     pub fn is_empty(&self) -> bool {
-        self.bloom.is_empty()
+        self.hashes.is_empty()
     }
 
     pub fn observe_and_analyze(
@@ -192,7 +192,7 @@ impl<'a, 'mir, 'tcx, M> InfiniteLoopDetector<'a, 'mir, 'tcx, M>
         snapshot.hash(&mut fx);
         let hash = fx.finish();
 
-        if self.bloom.insert(hash) {
+        if self.hashes.insert(hash) {
             // No collision
             return Ok(())
         }
diff --git a/src/librustc_mir/interpret/step.rs b/src/librustc_mir/interpret/step.rs
index b0c08304969..2025db48718 100644
--- a/src/librustc_mir/interpret/step.rs
+++ b/src/librustc_mir/interpret/step.rs
@@ -16,10 +16,10 @@ impl<'a, 'mir, 'tcx, M: Machine<'mir, 'tcx>> EvalContext<'a, 'mir, 'tcx, M>
     pub fn is_loop_detector_scheduled(&self) -> bool {
         /// The number of steps between loop detector snapshots.
         /// Should be a power of two for performance reasons.
-        const LOOP_SNAPSHOT_PERIOD: isize = 1 << 8;
+        const DETECTOR_SNAPSHOT_PERIOD: isize = 1 << 8;
 
         let steps = self.steps_until_detector_enabled;
-        steps <= 0 && steps % LOOP_SNAPSHOT_PERIOD == 0
+        steps <= 0 && steps % DETECTOR_SNAPSHOT_PERIOD == 0
     }
 
     pub fn inc_step_counter_and_detect_loops(&mut self, n: usize) -> EvalResult<'tcx, ()> {