1
Fork 0

Removed use of iteration through a HashMap/HashSet in rustc_incremental and replaced with IndexMap/IndexSet

This commit is contained in:
Andrew Xie 2023-04-07 02:26:08 -04:00
parent dcf3571c51
commit 17412bae30
12 changed files with 47 additions and 48 deletions

View file

@ -1,6 +1,6 @@
use parking_lot::Mutex;
use rustc_data_structures::fingerprint::Fingerprint;
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
use rustc_data_structures::fx::{FxHashMap, FxHashSet, FxIndexMap};
use rustc_data_structures::profiling::{EventId, QueryInvocationId, SelfProfilerRef};
use rustc_data_structures::sharded::{self, Sharded};
use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
@ -93,7 +93,7 @@ pub struct DepGraphData<K: DepKind> {
/// things available to us. If we find that they are not dirty, we
/// load the path to the file storing those work-products here into
/// this map. We can later look for and extract that data.
previous_work_products: FxHashMap<WorkProductId, WorkProduct>,
previous_work_products: FxIndexMap<WorkProductId, WorkProduct>,
dep_node_debug: Lock<FxHashMap<DepNode<K>, String>>,
@ -116,7 +116,7 @@ impl<K: DepKind> DepGraph<K> {
pub fn new(
profiler: &SelfProfilerRef,
prev_graph: SerializedDepGraph<K>,
prev_work_products: FxHashMap<WorkProductId, WorkProduct>,
prev_work_products: FxIndexMap<WorkProductId, WorkProduct>,
encoder: FileEncoder,
record_graph: bool,
record_stats: bool,
@ -688,7 +688,7 @@ impl<K: DepKind> DepGraph<K> {
/// Access the map of work-products created during the cached run. Only
/// used during saving of the dep-graph.
pub fn previous_work_products(&self) -> &FxHashMap<WorkProductId, WorkProduct> {
pub fn previous_work_products(&self) -> &FxIndexMap<WorkProductId, WorkProduct> {
&self.data.as_ref().unwrap().previous_work_products
}
@ -1048,7 +1048,7 @@ pub struct WorkProduct {
///
/// By convention, file extensions are currently used as identifiers, i.e. the key "o" maps to
/// the object file's path, and "dwo" to the dwarf object file's path.
pub saved_files: FxHashMap<String, String>,
pub saved_files: FxIndexMap<String, String>,
}
// Index type for `DepNodeData`'s edges.