diff options
| author | Markus Westerlind <markus.westerlind@distilnetworks.com> | 2020-03-07 22:46:15 +0100 |
|---|---|---|
| committer | Markus Westerlind <markus.westerlind@distilnetworks.com> | 2020-03-07 22:48:10 +0100 |
| commit | 4168c25b0f8aadcfe38c8bdae7cc51c22c2f45d1 (patch) | |
| tree | 18326109aad2302b5031fd60107c3df13763590b /src | |
| parent | c6f1215d925561021eec296d9e88aa0305d0a18d (diff) | |
| download | rust-4168c25b0f8aadcfe38c8bdae7cc51c22c2f45d1.tar.gz rust-4168c25b0f8aadcfe38c8bdae7cc51c22c2f45d1.zip | |
refactor: Add an alias for the SmallVec in dep_graph
Diffstat (limited to 'src')
| -rw-r--r-- | src/librustc/dep_graph/graph.rs | 18 |
1 files changed, 8 insertions, 10 deletions
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index 18bf77a8c4f..a37a7e760d8 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -350,12 +350,7 @@ impl DepGraph { { if let Some(ref data) = self.data { let (result, task_deps) = ty::tls::with_context(|icx| { - let task_deps = Lock::new(TaskDeps { - #[cfg(debug_assertions)] - node: None, - reads: SmallVec::new(), - read_set: Default::default(), - }); + let task_deps = Lock::new(TaskDeps::default()); let r = { let icx = ty::tls::ImplicitCtxt { task_deps: Some(&task_deps), ..icx.clone() }; @@ -968,7 +963,7 @@ pub enum WorkProductFileKind { #[derive(Clone)] struct DepNodeData { node: DepNode, - edges: SmallVec<[DepNodeIndex; 8]>, + edges: EdgesVec, fingerprint: Fingerprint, } @@ -1093,7 +1088,7 @@ impl CurrentDepGraph { fn alloc_node( &self, dep_node: DepNode, - edges: SmallVec<[DepNodeIndex; 8]>, + edges: EdgesVec, fingerprint: Fingerprint, ) -> DepNodeIndex { debug_assert!( @@ -1105,7 +1100,7 @@ impl CurrentDepGraph { fn intern_node( &self, dep_node: DepNode, - edges: SmallVec<[DepNodeIndex; 8]>, + edges: EdgesVec, fingerprint: Fingerprint, ) -> DepNodeIndex { match self.node_to_node_index.get_shard_by_value(&dep_node).lock().entry(dep_node) { @@ -1168,11 +1163,14 @@ impl DepGraphData { } } +/// The capacity of the `reads` field `SmallVec` const TASK_DEPS_READS_CAP: usize = 8; +type EdgesVec = SmallVec<[DepNodeIndex; TASK_DEPS_READS_CAP]>; +#[derive(Default)] pub struct TaskDeps { #[cfg(debug_assertions)] node: Option<DepNode>, - reads: SmallVec<[DepNodeIndex; TASK_DEPS_READS_CAP]>, + reads: EdgesVec, read_set: FxHashSet<DepNodeIndex>, } |
