Rollup merge of #50558 - whitfin:issue-50500, r=michaelwoerister
Remove all reference to DepGraph::work_products This is an attempt at fixing #50500. It will remove the `work_products` key from `DepGraphData` completely, in favour of just passing the relevant data around. I went in a little blindly; everything appears to work just fine but I'd appreciate any additional advice people. I didn't want to remove too much of what was already there, so I kept the structure pretty much the same (aside from some naming tweaks) - if anyone has suggestions on how to streamline it a little better, happy to follow up. r? @michaelwoerister
This commit is contained in:
@@ -13,7 +13,7 @@ use rustc_data_structures::stable_hasher::{HashStable, StableHasher};
|
||||
use rustc_data_structures::fx::{FxHashMap, FxHashSet};
|
||||
use rustc_data_structures::indexed_vec::{Idx, IndexVec};
|
||||
use rustc_data_structures::small_vec::SmallVec;
|
||||
use rustc_data_structures::sync::{Lrc, RwLock, ReadGuard, Lock};
|
||||
use rustc_data_structures::sync::{Lrc, Lock};
|
||||
use std::env;
|
||||
use std::hash::Hash;
|
||||
use ty::{self, TyCtxt};
|
||||
@@ -80,9 +80,6 @@ struct DepGraphData {
|
||||
/// this map. We can later look for and extract that data.
|
||||
previous_work_products: FxHashMap<WorkProductId, WorkProduct>,
|
||||
|
||||
/// Work-products that we generate in this run.
|
||||
work_products: RwLock<FxHashMap<WorkProductId, WorkProduct>>,
|
||||
|
||||
dep_node_debug: Lock<FxHashMap<DepNode, String>>,
|
||||
|
||||
// Used for testing, only populated when -Zquery-dep-graph is specified.
|
||||
@@ -103,7 +100,6 @@ impl DepGraph {
|
||||
DepGraph {
|
||||
data: Some(Lrc::new(DepGraphData {
|
||||
previous_work_products: prev_work_products,
|
||||
work_products: RwLock::new(FxHashMap()),
|
||||
dep_node_debug: Lock::new(FxHashMap()),
|
||||
current: Lock::new(CurrentDepGraph::new()),
|
||||
previous: prev_graph,
|
||||
@@ -462,19 +458,6 @@ impl DepGraph {
|
||||
self.data.as_ref().unwrap().previous.node_to_index(dep_node)
|
||||
}
|
||||
|
||||
/// Indicates that we created the given work-product in this run
|
||||
/// for `v`. This record will be preserved and loaded in the next
|
||||
/// run.
|
||||
pub fn insert_work_product(&self, v: &WorkProductId, data: WorkProduct) {
|
||||
debug!("insert_work_product({:?}, {:?})", v, data);
|
||||
self.data
|
||||
.as_ref()
|
||||
.unwrap()
|
||||
.work_products
|
||||
.borrow_mut()
|
||||
.insert(v.clone(), data);
|
||||
}
|
||||
|
||||
/// Check whether a previous work product exists for `v` and, if
|
||||
/// so, return the path that leads to it. Used to skip doing work.
|
||||
pub fn previous_work_product(&self, v: &WorkProductId) -> Option<WorkProduct> {
|
||||
@@ -485,12 +468,6 @@ impl DepGraph {
|
||||
})
|
||||
}
|
||||
|
||||
/// Access the map of work-products created during this run. Only
|
||||
/// used during saving of the dep-graph.
|
||||
pub fn work_products(&self) -> ReadGuard<FxHashMap<WorkProductId, WorkProduct>> {
|
||||
self.data.as_ref().unwrap().work_products.borrow()
|
||||
}
|
||||
|
||||
/// 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> {
|
||||
|
||||
Reference in New Issue
Block a user