diff options
| author | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-08-16 13:50:31 +0200 |
|---|---|---|
| committer | John Kåre Alsaker <john.kare.alsaker@gmail.com> | 2023-09-08 08:48:44 +0200 |
| commit | 8fc160b742e53eeb77a14b3e247b06b778f3243d (patch) | |
| tree | bc7e71a2ab910b69a5f6a402d80a6ff14124f987 /compiler/rustc_query_system/src/dep_graph | |
| parent | 3d249706aa8b0167dd49efa1b3ce7cc0e9cbba08 (diff) | |
Add optimized lock methods for `Sharded`
Diffstat (limited to 'compiler/rustc_query_system/src/dep_graph')
| -rw-r--r-- | compiler/rustc_query_system/src/dep_graph/graph.rs | 12 |
1 files changed, 3 insertions, 9 deletions
diff --git a/compiler/rustc_query_system/src/dep_graph/graph.rs b/compiler/rustc_query_system/src/dep_graph/graph.rs index 7b7981e1425..fa54e1a2e6a 100644 --- a/compiler/rustc_query_system/src/dep_graph/graph.rs +++ b/compiler/rustc_query_system/src/dep_graph/graph.rs @@ -629,12 +629,7 @@ impl<K: DepKind> DepGraphData<K> { if let Some(prev_index) = self.previous.node_to_index_opt(dep_node) { self.current.prev_index_to_index.lock()[prev_index] } else { - self.current - .new_node_to_index - .get_shard_by_value(dep_node) - .lock() - .get(dep_node) - .copied() + self.current.new_node_to_index.lock_shard_by_value(dep_node).get(dep_node).copied() } } @@ -1201,8 +1196,7 @@ impl<K: DepKind> CurrentDepGraph<K> { edges: EdgesVec, current_fingerprint: Fingerprint, ) -> DepNodeIndex { - let dep_node_index = match self.new_node_to_index.get_shard_by_value(&key).lock().entry(key) - { + let dep_node_index = match self.new_node_to_index.lock_shard_by_value(&key).entry(key) { Entry::Occupied(entry) => *entry.get(), Entry::Vacant(entry) => { let dep_node_index = @@ -1328,7 +1322,7 @@ impl<K: DepKind> CurrentDepGraph<K> { ) { let node = &prev_graph.index_to_node(prev_index); debug_assert!( - !self.new_node_to_index.get_shard_by_value(node).lock().contains_key(node), + !self.new_node_to_index.lock_shard_by_value(node).contains_key(node), "node from previous graph present in new node collection" ); } |
