diff options
| author | bors <bors@rust-lang.org> | 2019-05-07 10:48:16 +0000 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2019-05-07 10:48:16 +0000 |
| commit | c6ac57564852cb6e2d0db60f7b46d9eb98d4b449 (patch) | |
| tree | 22eaf85321002bac74c83168b183e38494874e56 | |
| parent | 55c48b4e823ad3518bb8e6d3fd7da4f2fc0c5fc2 (diff) | |
| parent | 97d3ad066d08d98ba574f2da8d379dce07fc286f (diff) | |
| download | rust-c6ac57564852cb6e2d0db60f7b46d9eb98d4b449.tar.gz rust-c6ac57564852cb6e2d0db60f7b46d9eb98d4b449.zip | |
Auto merge of #60573 - Zoxc:dep-stream-prefix-2, r=michaelwoerister
Only hash dep node indices of deps of anon tasks Another change split out from https://github.com/rust-lang/rust/pull/60035. r? @michaelwoerister
| -rw-r--r-- | src/librustc/dep_graph/graph.rs | 21 |
1 files changed, 9 insertions, 12 deletions
diff --git a/src/librustc/dep_graph/graph.rs b/src/librustc/dep_graph/graph.rs index 1ecc580d8c5..a87c98a04a4 100644 --- a/src/librustc/dep_graph/graph.rs +++ b/src/librustc/dep_graph/graph.rs @@ -1021,25 +1021,22 @@ impl CurrentDepGraph { fn complete_anon_task(&mut self, kind: DepKind, task_deps: TaskDeps) -> DepNodeIndex { debug_assert!(!kind.is_eval_always()); - let mut fingerprint = self.anon_id_seed; let mut hasher = StableHasher::new(); - for &read in task_deps.reads.iter() { - let read_dep_node = self.data[read].node; + // The dep node indices are hashed here instead of hashing the dep nodes of the + // dependencies. These indices may refer to different nodes per session, but this isn't + // a problem here because we that ensure the final dep node hash is per session only by + // combining it with the per session random number `anon_id_seed`. This hash only need + // to map the dependencies to a single value on a per session basis. + task_deps.reads.hash(&mut hasher); - ::std::mem::discriminant(&read_dep_node.kind).hash(&mut hasher); + let target_dep_node = DepNode { + kind, // Fingerprint::combine() is faster than sending Fingerprint // through the StableHasher (at least as long as StableHasher // is so slow). - fingerprint = fingerprint.combine(read_dep_node.hash); - } - - fingerprint = fingerprint.combine(hasher.finish()); - - let target_dep_node = DepNode { - kind, - hash: fingerprint, + hash: self.anon_id_seed.combine(hasher.finish()), }; self.intern_node(target_dep_node, task_deps.reads, Fingerprint::ZERO).0 |
