@@ -503,37 +503,48 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
503
503
504
504
// If -Zincremental-verify-ich is specified, re-hash results from
505
505
// the cache and make sure that they have the expected fingerprint.
506
- if self . sess . opts . debugging_opts . incremental_verify_ich {
507
- use rustc_data_structures :: stable_hasher :: { StableHasher , HashStable } ;
508
- use ich :: Fingerprint ;
506
+ if unlikely ! ( self . sess. opts. debugging_opts. incremental_verify_ich) {
507
+ self . incremental_verify_ich :: < Q > ( & result , dep_node , dep_node_index ) ;
508
+ }
509
509
510
- assert ! ( Some ( self . dep_graph. fingerprint_of( dep_node_index) ) ==
511
- self . dep_graph. prev_fingerprint_of( dep_node) ,
512
- "Fingerprint for green query instance not loaded \
513
- from cache: {:?}", dep_node) ;
510
+ if unlikely ! ( self . sess. opts. debugging_opts. query_dep_graph) {
511
+ self . dep_graph . mark_loaded_from_cache ( dep_node_index, true ) ;
512
+ }
514
513
515
- debug ! ( "BEGIN verify_ich({:?})" , dep_node) ;
516
- let mut hcx = self . create_stable_hashing_context ( ) ;
517
- let mut hasher = StableHasher :: new ( ) ;
514
+ job. complete ( & result, dep_node_index) ;
518
515
519
- result. hash_stable ( & mut hcx, & mut hasher) ;
516
+ Ok ( result)
517
+ }
520
518
521
- let new_hash: Fingerprint = hasher. finish ( ) ;
522
- debug ! ( "END verify_ich({:?})" , dep_node) ;
519
+ #[ inline( never) ]
520
+ #[ cold]
521
+ fn incremental_verify_ich < Q : QueryDescription < ' gcx > > (
522
+ self ,
523
+ result : & Q :: Value ,
524
+ dep_node : & DepNode ,
525
+ dep_node_index : DepNodeIndex ,
526
+ ) {
527
+ use rustc_data_structures:: stable_hasher:: { StableHasher , HashStable } ;
528
+ use ich:: Fingerprint ;
523
529
524
- let old_hash = self . dep_graph . fingerprint_of ( dep_node_index) ;
530
+ assert ! ( Some ( self . dep_graph. fingerprint_of( dep_node_index) ) ==
531
+ self . dep_graph. prev_fingerprint_of( dep_node) ,
532
+ "Fingerprint for green query instance not loaded \
533
+ from cache: {:?}", dep_node) ;
525
534
526
- assert ! ( new_hash == old_hash , "Found unstable fingerprints \
527
- for {:?}" , dep_node ) ;
528
- }
535
+ debug ! ( "BEGIN verify_ich({:?})" , dep_node ) ;
536
+ let mut hcx = self . create_stable_hashing_context ( ) ;
537
+ let mut hasher = StableHasher :: new ( ) ;
529
538
530
- if self . sess . opts . debugging_opts . query_dep_graph {
531
- self . dep_graph . mark_loaded_from_cache ( dep_node_index, true ) ;
532
- }
539
+ result. hash_stable ( & mut hcx, & mut hasher) ;
533
540
534
- job. complete ( & result, dep_node_index) ;
541
+ let new_hash: Fingerprint = hasher. finish ( ) ;
542
+ debug ! ( "END verify_ich({:?})" , dep_node) ;
535
543
536
- Ok ( result)
544
+ let old_hash = self . dep_graph . fingerprint_of ( dep_node_index) ;
545
+
546
+ assert ! ( new_hash == old_hash, "Found unstable fingerprints \
547
+ for {:?}", dep_node) ;
537
548
}
538
549
539
550
fn force_query_with_job < Q : QueryDescription < ' gcx > > (
@@ -578,7 +589,7 @@ impl<'a, 'gcx, 'tcx> TyCtxt<'a, 'gcx, 'tcx> {
578
589
579
590
let ( ( result, dep_node_index) , diagnostics) = res;
580
591
581
- if self . sess . opts . debugging_opts . query_dep_graph {
592
+ if unlikely ! ( self . sess. opts. debugging_opts. query_dep_graph) {
582
593
self . dep_graph . mark_loaded_from_cache ( dep_node_index, false ) ;
583
594
}
584
595
0 commit comments