Prefetch queries used by the metadata encoder
This commit is contained in:
parent
3c6f982cc9
commit
6cd0dcade7
1 changed files with 17 additions and 1 deletions
|
@ -18,7 +18,7 @@ use rustc_ast::attr;
|
|||
use rustc_data_structures::fingerprint::Fingerprint;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::stable_hasher::StableHasher;
|
||||
use rustc_data_structures::sync::Lrc;
|
||||
use rustc_data_structures::sync::{join, par_for_each_in, Lrc};
|
||||
use rustc_hir as hir;
|
||||
use rustc_hir::def::CtorKind;
|
||||
use rustc_hir::def_id::{CrateNum, DefId, DefIndex, LocalDefId, CRATE_DEF_INDEX, LOCAL_CRATE};
|
||||
|
@ -1721,6 +1721,22 @@ impl<'tcx, 'v> ItemLikeVisitor<'v> for ImplVisitor<'tcx> {
|
|||
// generated regardless of trailing bytes that end up in it.
|
||||
|
||||
pub(super) fn encode_metadata(tcx: TyCtxt<'_>) -> EncodedMetadata {
|
||||
join(
|
||||
|| encode_metadata_impl(tcx),
|
||||
|| {
|
||||
// Prefetch some queries used by metadata encoding
|
||||
tcx.dep_graph.with_ignore(|| {
|
||||
par_for_each_in(tcx.mir_keys(LOCAL_CRATE), |&def_id| {
|
||||
tcx.optimized_mir(def_id);
|
||||
tcx.promoted_mir(def_id);
|
||||
});
|
||||
})
|
||||
},
|
||||
)
|
||||
.0
|
||||
}
|
||||
|
||||
fn encode_metadata_impl(tcx: TyCtxt<'_>) -> EncodedMetadata {
|
||||
let mut encoder = opaque::Encoder::new(vec![]);
|
||||
encoder.emit_raw_bytes(METADATA_HEADER);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue