Skip to content

Commit 996511a

Browse files
Use 'relaxed' memory ordering for simple atomic counters in dep-graph.
1 parent a62c040 commit 996511a

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/librustc/dep_graph/graph.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -497,8 +497,8 @@ impl DepGraph {
497497
let current_dep_graph = &self.data.as_ref().unwrap().current;
498498

499499
Some((
500-
current_dep_graph.total_read_count.load(SeqCst),
501-
current_dep_graph.total_duplicate_read_count.load(SeqCst),
500+
current_dep_graph.total_read_count.load(Relaxed),
501+
current_dep_graph.total_duplicate_read_count.load(Relaxed),
502502
))
503503
} else {
504504
None
@@ -1111,7 +1111,7 @@ impl DepGraphData {
11111111
if let Some(task_deps) = icx.task_deps {
11121112
let mut task_deps = task_deps.lock();
11131113
if cfg!(debug_assertions) {
1114-
self.current.total_read_count.fetch_add(1, SeqCst);
1114+
self.current.total_read_count.fetch_add(1, Relaxed);
11151115
}
11161116
if task_deps.read_set.insert(source) {
11171117
task_deps.reads.push(source);
@@ -1129,7 +1129,7 @@ impl DepGraphData {
11291129
}
11301130
}
11311131
} else if cfg!(debug_assertions) {
1132-
self.current.total_duplicate_read_count.fetch_add(1, SeqCst);
1132+
self.current.total_duplicate_read_count.fetch_add(1, Relaxed);
11331133
}
11341134
}
11351135
})

0 commit comments

Comments
 (0)