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