@@ -48,23 +48,22 @@ macro_rules! provide {
48
48
$tcx: TyCtxt <$lt>,
49
49
def_id_arg: T ,
50
50
) -> <ty:: queries:: $name<$lt> as QueryConfig <$lt>>:: Value {
51
+ let _prof_timer =
52
+ $tcx. prof. generic_activity( "metadata_decode_entry" ) ;
53
+
51
54
#[ allow( unused_variables) ]
52
55
let ( $def_id, $other) = def_id_arg. into_args( ) ;
53
56
assert!( !$def_id. is_local( ) ) ;
54
57
55
- let def_path_hash = $tcx. def_path_hash( DefId {
56
- krate: $def_id. krate,
57
- index: CRATE_DEF_INDEX
58
- } ) ;
59
- let dep_node = def_path_hash
60
- . to_dep_node( rustc:: dep_graph:: DepKind :: CrateMetadata ) ;
61
- // The DepNodeIndex of the DepNode::CrateMetadata should be
62
- // cached somewhere, so that we can use read_index().
63
- $tcx. dep_graph. read( dep_node) ;
64
-
65
58
let $cdata = $tcx. crate_data_as_rc_any( $def_id. krate) ;
66
59
let $cdata = $cdata. downcast_ref:: <cstore:: CrateMetadata >( )
67
60
. expect( "CrateStore created data is not a CrateMetadata" ) ;
61
+
62
+ if $tcx. dep_graph. is_fully_enabled( ) {
63
+ let crate_dep_node_index = $cdata. get_crate_dep_node_index( $tcx) ;
64
+ $tcx. dep_graph. read_index( crate_dep_node_index) ;
65
+ }
66
+
68
67
$compute
69
68
} ) *
70
69
@@ -449,6 +448,8 @@ impl cstore::CStore {
449
448
}
450
449
451
450
pub fn load_macro_untracked ( & self , id : DefId , sess : & Session ) -> LoadedMacro {
451
+ let _prof_timer = sess. prof . generic_activity ( "metadata_load_macro" ) ;
452
+
452
453
let data = self . get_crate_data ( id. krate ) ;
453
454
if data. is_proc_macro_crate ( ) {
454
455
return LoadedMacro :: ProcMacro ( data. load_proc_macro ( id. index , sess) ) ;
@@ -526,20 +527,10 @@ impl CrateStore for cstore::CStore {
526
527
/// parent `DefId` as well as some idea of what kind of data the
527
528
/// `DefId` refers to.
528
529
fn def_key ( & self , def : DefId ) -> DefKey {
529
- // Note: loading the def-key (or def-path) for a def-id is not
530
- // a *read* of its metadata. This is because the def-id is
531
- // really just an interned shorthand for a def-path, which is the
532
- // canonical name for an item.
533
- //
534
- // self.dep_graph.read(DepNode::MetaData(def));
535
530
self . get_crate_data ( def. krate ) . def_key ( def. index )
536
531
}
537
532
538
533
fn def_path ( & self , def : DefId ) -> DefPath {
539
- // See `Note` above in `def_key()` for why this read is
540
- // commented out:
541
- //
542
- // self.dep_graph.read(DepNode::MetaData(def));
543
534
self . get_crate_data ( def. krate ) . def_path ( def. index )
544
535
}
545
536
0 commit comments