Skip to content
Permalink
Browse files

Use 'relaxed' memory ordering for simple atomic counters in dep-graph.

  • Loading branch information
michaelwoerister committed Dec 13, 2019
1 parent a62c040 commit 996511a45655e452ec3132094e08dcbebee36a67
Showing with 4 additions and 4 deletions.
  1. +4 −4 src/librustc/dep_graph/graph.rs
@@ -497,8 +497,8 @@ impl DepGraph {
let current_dep_graph = &self.data.as_ref().unwrap().current;

Some((
current_dep_graph.total_read_count.load(SeqCst),
current_dep_graph.total_duplicate_read_count.load(SeqCst),
current_dep_graph.total_read_count.load(Relaxed),
current_dep_graph.total_duplicate_read_count.load(Relaxed),
))
} else {
None
@@ -1111,7 +1111,7 @@ impl DepGraphData {
if let Some(task_deps) = icx.task_deps {
let mut task_deps = task_deps.lock();
if cfg!(debug_assertions) {
self.current.total_read_count.fetch_add(1, SeqCst);
self.current.total_read_count.fetch_add(1, Relaxed);
}
if task_deps.read_set.insert(source) {
task_deps.reads.push(source);
@@ -1129,7 +1129,7 @@ impl DepGraphData {
}
}
} else if cfg!(debug_assertions) {
self.current.total_duplicate_read_count.fetch_add(1, SeqCst);
self.current.total_duplicate_read_count.fetch_add(1, Relaxed);
}
}
})

0 comments on commit 996511a

Please sign in to comment.
You can’t perform that action at this time.