Auto merge of #110040 - ndrewxie:issue-84447-partial-1, r=lcnr,michaelwoerister
Removed use of iteration through a HashMap/HashSet in rustc_incremental and replaced with IndexMap/IndexSet This allows for the `#[allow(rustc::potential_query_instability)]` in rustc_incremental to be removed, moving towards fixing #84447 (although a LOT more modules have to be changed to fully resolve it). Only HashMaps/HashSets that are being iterated through have been modified (although many structs and traits outside of rustc_incremental had to be modified as well, as they had fields/methods that involved a HashMap/HashSet that would be iterated through) I'm making a PR for just 1 module changed to test for performance regressions and such, for future changes I'll either edit this PR to reflect additional modules being converted, or batch multiple modules of changes together and make a PR for each group of modules.
This commit is contained in:
commit
a0df04c0f2
25 changed files with 259 additions and 190 deletions
|
@ -9,7 +9,7 @@ use crate::{
|
|||
};
|
||||
use jobserver::{Acquired, Client};
|
||||
use rustc_ast::attr;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::fx::{FxHashMap, FxIndexMap};
|
||||
use rustc_data_structures::memmap::Mmap;
|
||||
use rustc_data_structures::profiling::SelfProfilerRef;
|
||||
use rustc_data_structures::profiling::TimingGuard;
|
||||
|
@ -498,8 +498,8 @@ pub fn start_async_codegen<B: ExtraBackendMethods>(
|
|||
fn copy_all_cgu_workproducts_to_incr_comp_cache_dir(
|
||||
sess: &Session,
|
||||
compiled_modules: &CompiledModules,
|
||||
) -> FxHashMap<WorkProductId, WorkProduct> {
|
||||
let mut work_products = FxHashMap::default();
|
||||
) -> FxIndexMap<WorkProductId, WorkProduct> {
|
||||
let mut work_products = FxIndexMap::default();
|
||||
|
||||
if sess.opts.incremental.is_none() {
|
||||
return work_products;
|
||||
|
@ -1885,7 +1885,7 @@ pub struct OngoingCodegen<B: ExtraBackendMethods> {
|
|||
}
|
||||
|
||||
impl<B: ExtraBackendMethods> OngoingCodegen<B> {
|
||||
pub fn join(self, sess: &Session) -> (CodegenResults, FxHashMap<WorkProductId, WorkProduct>) {
|
||||
pub fn join(self, sess: &Session) -> (CodegenResults, FxIndexMap<WorkProductId, WorkProduct>) {
|
||||
let _timer = sess.timer("finish_ongoing_codegen");
|
||||
|
||||
self.shared_emitter_main.check(sess, true);
|
||||
|
|
|
@ -6,7 +6,7 @@ use crate::back::write::TargetMachineFactoryFn;
|
|||
use crate::{CodegenResults, ModuleCodegen};
|
||||
|
||||
use rustc_ast::expand::allocator::AllocatorKind;
|
||||
use rustc_data_structures::fx::FxHashMap;
|
||||
use rustc_data_structures::fx::FxIndexMap;
|
||||
use rustc_data_structures::sync::{DynSend, DynSync};
|
||||
use rustc_errors::ErrorGuaranteed;
|
||||
use rustc_metadata::EncodedMetadata;
|
||||
|
@ -101,7 +101,7 @@ pub trait CodegenBackend {
|
|||
ongoing_codegen: Box<dyn Any>,
|
||||
sess: &Session,
|
||||
outputs: &OutputFilenames,
|
||||
) -> Result<(CodegenResults, FxHashMap<WorkProductId, WorkProduct>), ErrorGuaranteed>;
|
||||
) -> Result<(CodegenResults, FxIndexMap<WorkProductId, WorkProduct>), ErrorGuaranteed>;
|
||||
|
||||
/// This is called on the returned `Box<dyn Any>` from `join_codegen`
|
||||
///
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue