Skip to content

Commit db0bd38

Browse files
committed
Prefetch upstream_monomorphizations
1 parent 7a6895f commit db0bd38

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/librustc_mir/monomorphize/collector.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ use rustc::ty::print::obsolete::DefPathBasedNames;
189189
use rustc::ty::subst::{InternalSubsts, SubstsRef};
190190
use rustc::ty::{self, GenericParamDefKind, Instance, Ty, TyCtxt, TypeFoldable};
191191
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
192-
use rustc_data_structures::sync::{par_for_each, MTLock, MTRef};
192+
use rustc_data_structures::sync::{join, par_for_each, MTLock, MTRef};
193193
use rustc_hir as hir;
194194
use rustc_hir::def_id::{DefId, DefIdMap, LOCAL_CRATE};
195195
use rustc_hir::itemlikevisit::ItemLikeVisitor;
@@ -278,8 +278,16 @@ pub fn collect_crate_mono_items(
278278
) -> (FxHashSet<MonoItem<'_>>, InliningMap<'_>) {
279279
let _prof_timer = tcx.prof.generic_activity("monomorphization_collector");
280280

281-
let roots =
282-
tcx.sess.time("monomorphization_collector_root_collections", || collect_roots(tcx, mode));
281+
let (roots, _) = join(
282+
|| {
283+
tcx.sess
284+
.time("monomorphization_collector_root_collections", || collect_roots(tcx, mode))
285+
},
286+
|| {
287+
// Prefetch upstream_monomorphizations
288+
tcx.upstream_monomorphizations(LOCAL_CRATE);
289+
},
290+
);
283291

284292
debug!("building mono item graph, beginning at roots");
285293

0 commit comments

Comments
 (0)