Skip to content

Commit

Permalink
Use 'relaxed' memory ordering for simple atomic counters in dep-graph.
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelwoerister committed Dec 18, 2019
1 parent 603892d commit 52a0d69
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/librustc/dep_graph/graph.rs
Original file line number Diff line number Diff line change
Expand Up @@ -501,8 +501,8 @@ impl DepGraph {
if cfg!(debug_assertions) {
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)))
Some((current_dep_graph.total_read_count.load(Relaxed),
current_dep_graph.total_duplicate_read_count.load(Relaxed)))
} else {
None
}
Expand Down Expand Up @@ -1114,7 +1114,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);
Expand All @@ -1134,7 +1134,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);
}
}
})
Expand Down

0 comments on commit 52a0d69

Please sign in to comment.