aboutsummaryrefslogtreecommitdiff
path: root/src/link.zig
diff options
context:
space:
mode:
authormlugg <mlugg@mlugg.co.uk>2025-06-13 19:05:44 +0100
committermlugg <mlugg@mlugg.co.uk>2025-06-13 19:05:44 +0100
commit121d62044399da0957fe3bf80c87ef23d7cdb1a3 (patch)
tree92e671cfe9021a01debe208ff0633bfec506a6dd /src/link.zig
parentdd75e7bcb1fe142f4d60dc2d83e6feee53e580f3 (diff)
downloadzig-121d62044399da0957fe3bf80c87ef23d7cdb1a3.tar.gz
zig-121d62044399da0957fe3bf80c87ef23d7cdb1a3.zip
compiler: fix atomic orderings
I messed up atomic orderings on this variable because they changed in a local refactor at some point. We need to always release on the store and acquire on the loads so that a linker thread observing `.ready` sees the stored MIR.
Diffstat (limited to 'src/link.zig')
-rw-r--r--src/link.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/link.zig b/src/link.zig
index 9bed6b4131..29ee0c7b15 100644
--- a/src/link.zig
+++ b/src/link.zig
@@ -1249,7 +1249,7 @@ pub const ZcuTask = union(enum) {
.update_line_number,
=> {},
.link_func => |link_func| {
- switch (link_func.mir.status.load(.monotonic)) {
+ switch (link_func.mir.status.load(.acquire)) {
.pending => unreachable, // cannot deinit until MIR done
.failed => {}, // MIR not populated so doesn't need freeing
.ready => link_func.mir.value.deinit(zcu),
@@ -1453,7 +1453,7 @@ pub fn doZcuTask(comp: *Compilation, tid: usize, task: ZcuTask) void {
const fqn_slice = ip.getNav(nav).fqn.toSlice(ip);
const nav_prog_node = comp.link_prog_node.start(fqn_slice, 0);
defer nav_prog_node.end();
- switch (func.mir.status.load(.monotonic)) {
+ switch (func.mir.status.load(.acquire)) {
.pending => unreachable,
.ready => {},
.failed => return,