@@ -29,18 +29,18 @@ use crate::const_eval::CompileTimeInterpreter;
29
29
30
30
#[ derive( Default ) ]
31
31
pub ( crate ) struct InfiniteLoopDetector < ' a , ' mir , ' tcx : ' a + ' mir > {
32
- /// The set of all `EvalSnapshot ` *hashes* observed by this detector.
32
+ /// The set of all `InterpSnapshot ` *hashes* observed by this detector.
33
33
///
34
34
/// When a collision occurs in this table, we store the full snapshot in
35
35
/// `snapshots`.
36
36
hashes : FxHashSet < u64 > ,
37
37
38
- /// The set of all `EvalSnapshot `s observed by this detector.
38
+ /// The set of all `InterpSnapshot `s observed by this detector.
39
39
///
40
- /// An `EvalSnapshot ` will only be fully cloned once it has caused a
40
+ /// An `InterpSnapshot ` will only be fully cloned once it has caused a
41
41
/// collision in `hashes`. As a result, the detector must observe at least
42
42
/// *two* full cycles of an infinite loop before it triggers.
43
- snapshots : FxHashSet < EvalSnapshot < ' a , ' mir , ' tcx > > ,
43
+ snapshots : FxHashSet < InterpSnapshot < ' a , ' mir , ' tcx > > ,
44
44
}
45
45
46
46
impl < ' a , ' mir , ' tcx > InfiniteLoopDetector < ' a , ' mir , ' tcx >
@@ -72,7 +72,7 @@ impl<'a, 'mir, 'tcx> InfiniteLoopDetector<'a, 'mir, 'tcx>
72
72
// We need to make a full copy. NOW things that to get really expensive.
73
73
info ! ( "snapshotting the state of the interpreter" ) ;
74
74
75
- if self . snapshots . insert ( EvalSnapshot :: new ( memory, stack) ) {
75
+ if self . snapshots . insert ( InterpSnapshot :: new ( memory, stack) ) {
76
76
// Spurious collision or first cycle
77
77
return Ok ( ( ) )
78
78
}
@@ -384,18 +384,18 @@ impl<'a, 'b, 'mir, 'tcx: 'a+'mir> SnapshotContext<'b>
384
384
/// The virtual machine state during const-evaluation at a given point in time.
385
385
/// We assume the `CompileTimeInterpreter` has no interesting extra state that
386
386
/// is worth considering here.
387
- struct EvalSnapshot < ' a , ' mir , ' tcx : ' a + ' mir > {
387
+ struct InterpSnapshot < ' a , ' mir , ' tcx : ' a + ' mir > {
388
388
memory : Memory < ' a , ' mir , ' tcx , CompileTimeInterpreter < ' a , ' mir , ' tcx > > ,
389
389
stack : Vec < Frame < ' mir , ' tcx > > ,
390
390
}
391
391
392
- impl < ' a , ' mir , ' tcx : ' a + ' mir > EvalSnapshot < ' a , ' mir , ' tcx >
392
+ impl < ' a , ' mir , ' tcx : ' a + ' mir > InterpSnapshot < ' a , ' mir , ' tcx >
393
393
{
394
394
fn new (
395
395
memory : & Memory < ' a , ' mir , ' tcx , CompileTimeInterpreter < ' a , ' mir , ' tcx > > ,
396
396
stack : & [ Frame < ' mir , ' tcx > ]
397
397
) -> Self {
398
- EvalSnapshot {
398
+ InterpSnapshot {
399
399
memory : memory. clone ( ) ,
400
400
stack : stack. into ( ) ,
401
401
}
@@ -411,7 +411,7 @@ impl<'a, 'mir, 'tcx: 'a + 'mir> EvalSnapshot<'a, 'mir, 'tcx>
411
411
412
412
}
413
413
414
- impl < ' a , ' mir , ' tcx > Hash for EvalSnapshot < ' a , ' mir , ' tcx >
414
+ impl < ' a , ' mir , ' tcx > Hash for InterpSnapshot < ' a , ' mir , ' tcx >
415
415
{
416
416
fn hash < H : Hasher > ( & self , state : & mut H ) {
417
417
// Implement in terms of hash stable, so that k1 == k2 -> hash(k1) == hash(k2)
@@ -422,16 +422,16 @@ impl<'a, 'mir, 'tcx> Hash for EvalSnapshot<'a, 'mir, 'tcx>
422
422
}
423
423
}
424
424
425
- impl_stable_hash_for ! ( impl <' tcx, ' b, ' mir> for struct EvalSnapshot <' b, ' mir, ' tcx> {
425
+ impl_stable_hash_for ! ( impl <' tcx, ' b, ' mir> for struct InterpSnapshot <' b, ' mir, ' tcx> {
426
426
// Not hashing memory: Avoid hashing memory all the time during execution
427
427
memory -> _,
428
428
stack,
429
429
} ) ;
430
430
431
- impl < ' a , ' mir , ' tcx > Eq for EvalSnapshot < ' a , ' mir , ' tcx >
431
+ impl < ' a , ' mir , ' tcx > Eq for InterpSnapshot < ' a , ' mir , ' tcx >
432
432
{ }
433
433
434
- impl < ' a , ' mir , ' tcx > PartialEq for EvalSnapshot < ' a , ' mir , ' tcx >
434
+ impl < ' a , ' mir , ' tcx > PartialEq for InterpSnapshot < ' a , ' mir , ' tcx >
435
435
{
436
436
fn eq ( & self , other : & Self ) -> bool {
437
437
// FIXME: This looks to be a *ridiculously expensive* comparison operation.
0 commit comments