diff options
| author | bors <bors@rust-lang.org> | 2020-04-11 15:31:54 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2020-04-11 15:31:54 +0000 |
| commit | e82734e56b2a50d38e0937d08f559d15dbe8e46b (patch) | |
| tree | 0a466bbbf764ae05b172f937e2cf3e642be4fb08 /src/librustc_mir | |
| parent | 76882666eba15a186402a911c227f8e9c1682186 (diff) | |
| parent | 802c0be3a225ff13826288ee7030899ff21bec33 (diff) | |
| download | rust-e82734e56b2a50d38e0937d08f559d15dbe8e46b.tar.gz rust-e82734e56b2a50d38e0937d08f559d15dbe8e46b.zip | |
Auto merge of #70161 - cjgillot:query-arena, r=nikomatsakis
Allocate some query results on an arena This avoids a cloning few `Lrc` and `Vec`s in the queries.
Diffstat (limited to 'src/librustc_mir')
| -rw-r--r-- | src/librustc_mir/monomorphize/partitioning.rs | 18 |
1 files changed, 9 insertions, 9 deletions
diff --git a/src/librustc_mir/monomorphize/partitioning.rs b/src/librustc_mir/monomorphize/partitioning.rs index 44aa9a710b6..5f75633ae59 100644 --- a/src/librustc_mir/monomorphize/partitioning.rs +++ b/src/librustc_mir/monomorphize/partitioning.rs @@ -94,7 +94,6 @@ use std::cmp; use std::collections::hash_map::Entry; -use std::sync::Arc; use rustc_data_structures::fx::{FxHashMap, FxHashSet}; use rustc_data_structures::sync; @@ -890,7 +889,7 @@ where fn collect_and_partition_mono_items( tcx: TyCtxt<'_>, cnum: CrateNum, -) -> (Arc<DefIdSet>, Arc<Vec<Arc<CodegenUnit<'_>>>>) { +) -> (&'tcx DefIdSet, &'tcx [CodegenUnit<'_>]) { assert_eq!(cnum, LOCAL_CRATE); let collection_mode = match tcx.sess.opts.debugging_opts.print_mono_items { @@ -928,10 +927,12 @@ fn collect_and_partition_mono_items( let (codegen_units, _) = tcx.sess.time("partition_and_assert_distinct_symbols", || { sync::join( || { - partition(tcx, items.iter().cloned(), tcx.sess.codegen_units(), &inlining_map) - .into_iter() - .map(Arc::new) - .collect::<Vec<_>>() + &*tcx.arena.alloc_from_iter(partition( + tcx, + items.iter().cloned(), + tcx.sess.codegen_units(), + &inlining_map, + )) }, || assert_symbols_are_distinct(tcx, items.iter()), ) @@ -949,7 +950,7 @@ fn collect_and_partition_mono_items( if tcx.sess.opts.debugging_opts.print_mono_items.is_some() { let mut item_to_cgus: FxHashMap<_, Vec<_>> = Default::default(); - for cgu in &codegen_units { + for cgu in codegen_units { for (&mono_item, &linkage) in cgu.items() { item_to_cgus.entry(mono_item).or_default().push((cgu.name(), linkage)); } @@ -997,7 +998,7 @@ fn collect_and_partition_mono_items( } } - (Arc::new(mono_items), Arc::new(codegen_units)) + (tcx.arena.alloc(mono_items), codegen_units) } pub fn provide(providers: &mut Providers<'_>) { @@ -1012,7 +1013,6 @@ pub fn provide(providers: &mut Providers<'_>) { let (_, all) = tcx.collect_and_partition_mono_items(LOCAL_CRATE); all.iter() .find(|cgu| cgu.name() == name) - .cloned() .unwrap_or_else(|| panic!("failed to find cgu with name {:?}", name)) }; } |
