From 5ce40e61c6f5c05925aa5116cc6c61fbae8a6263 Mon Sep 17 00:00:00 2001 From: Michael Dusan Date: Fri, 15 Mar 2024 02:28:50 -0400 Subject: [PATCH] bsd: debitrot AtomicOrder renames - complete std.builtin.AtomicOrder renames that were missed from 6067d39522f --- lib/compiler_rt/emutls.zig | 4 ++-- lib/std/Thread/Futex.zig | 8 ++++---- lib/std/Thread/RwLock.zig | 2 +- lib/std/atomic.zig | 2 +- src/Air.zig | 6 +++--- src/arch/sparc64/CodeGen.zig | 8 ++++---- 6 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/compiler_rt/emutls.zig b/lib/compiler_rt/emutls.zig index 265fcb8782..db14ad04ee 100644 --- a/lib/compiler_rt/emutls.zig +++ b/lib/compiler_rt/emutls.zig @@ -246,7 +246,7 @@ const emutls_control = extern struct { // Two threads could race against the same emutls_control. // Use atomic for reading coherent value lockless. - const index_lockless = @atomicLoad(usize, &self.object.index, .Acquire); + const index_lockless = @atomicLoad(usize, &self.object.index, .acquire); if (index_lockless != 0) { // index is already initialized, return it. @@ -264,7 +264,7 @@ const emutls_control = extern struct { } // Store a new index atomically (for having coherent index_lockless reading). - @atomicStore(usize, &self.object.index, emutls_control.next_index, .Release); + @atomicStore(usize, &self.object.index, emutls_control.next_index, .release); // Increment the next available index emutls_control.next_index += 1; diff --git a/lib/std/Thread/Futex.zig b/lib/std/Thread/Futex.zig index 160d983c71..764d3f13e1 100644 --- a/lib/std/Thread/Futex.zig +++ b/lib/std/Thread/Futex.zig @@ -801,7 +801,7 @@ const PosixImpl = struct { assert(std.c.pthread_mutex_lock(&bucket.mutex) == .SUCCESS); defer assert(std.c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS); - cancelled = ptr.load(.Monotonic) != expect; + cancelled = ptr.load(.monotonic) != expect; if (cancelled) { return; } @@ -855,14 +855,14 @@ const PosixImpl = struct { // The pending count increment in wait() must also now use seq_cst for the update + this pending load // to be in the same modification order as our load isn't using release/acquire to guarantee it. bucket.pending.fence(.seq_cst); - if (bucket.pending.load(.Monotonic) == 0) { + if (bucket.pending.load(.monotonic) == 0) { return; } // Keep a list of all the waiters notified and wake then up outside the mutex critical section. var notified = WaitList{}; defer if (notified.len > 0) { - const pending = bucket.pending.fetchSub(notified.len, .Monotonic); + const pending = bucket.pending.fetchSub(notified.len, .monotonic); assert(pending >= notified.len); while (notified.pop()) |waiter| { @@ -875,7 +875,7 @@ const PosixImpl = struct { defer assert(std.c.pthread_mutex_unlock(&bucket.mutex) == .SUCCESS); // Another pending check again to avoid the WaitQueue lookup if not necessary. - if (bucket.pending.load(.Monotonic) > 0) { + if (bucket.pending.load(.monotonic) > 0) { notified = WaitQueue.remove(&bucket.treap, address, max_waiters); } } diff --git a/lib/std/Thread/RwLock.zig b/lib/std/Thread/RwLock.zig index 2152c0756c..c4a8755907 100644 --- a/lib/std/Thread/RwLock.zig +++ b/lib/std/Thread/RwLock.zig @@ -375,5 +375,5 @@ test "concurrent access" { try testing.expectEqual(num_writes, runner.writes); - //std.debug.print("reads={}\n", .{ runner.reads.load(.Unordered)}); + //std.debug.print("reads={}\n", .{ runner.reads.load(.unordered)}); } diff --git a/lib/std/atomic.zig b/lib/std/atomic.zig index bc8b181715..a485572140 100644 --- a/lib/std/atomic.zig +++ b/lib/std/atomic.zig @@ -159,7 +159,7 @@ test Value { // acquire ensures count decrement and code before // previous unrefs()s happens-before we call dropFn // below. - // Another alternative is to use .AcqRel on the + // Another alternative is to use .acq_rel on the // fetchSub count decrement but it's extra barrier in // possibly hot path. rc.count.fence(.acquire); diff --git a/src/Air.zig b/src/Air.zig index e014e225e0..5513abdbfb 100644 --- a/src/Air.zig +++ b/src/Air.zig @@ -727,11 +727,11 @@ pub const Inst = struct { /// Result type is always `void`. /// Uses the `bin_op` field. LHS is pointer, RHS is element. atomic_store_unordered, - /// Same as `atomic_store_unordered` but with `AtomicOrder.Monotonic`. + /// Same as `atomic_store_unordered` but with `AtomicOrder.monotonic`. atomic_store_monotonic, - /// Same as `atomic_store_unordered` but with `AtomicOrder.Release`. + /// Same as `atomic_store_unordered` but with `AtomicOrder.release`. atomic_store_release, - /// Same as `atomic_store_unordered` but with `AtomicOrder.SeqCst`. + /// Same as `atomic_store_unordered` but with `AtomicOrder.seq_cst`. atomic_store_seq_cst, /// Atomically read-modify-write via a pointer. /// Result type is the element type of the pointer. diff --git a/src/arch/sparc64/CodeGen.zig b/src/arch/sparc64/CodeGen.zig index 0ab82abdd6..b6b3f30879 100644 --- a/src/arch/sparc64/CodeGen.zig +++ b/src/arch/sparc64/CodeGen.zig @@ -647,10 +647,10 @@ fn genBody(self: *Self, body: []const Air.Inst.Index) InnerError!void { .call_never_tail => try self.airCall(inst, .never_tail), .call_never_inline => try self.airCall(inst, .never_inline), - .atomic_store_unordered => @panic("TODO try self.airAtomicStore(inst, .Unordered)"), - .atomic_store_monotonic => @panic("TODO try self.airAtomicStore(inst, .Monotonic)"), - .atomic_store_release => @panic("TODO try self.airAtomicStore(inst, .Release)"), - .atomic_store_seq_cst => @panic("TODO try self.airAtomicStore(inst, .SeqCst)"), + .atomic_store_unordered => @panic("TODO try self.airAtomicStore(inst, .unordered)"), + .atomic_store_monotonic => @panic("TODO try self.airAtomicStore(inst, .monotonic)"), + .atomic_store_release => @panic("TODO try self.airAtomicStore(inst, .release)"), + .atomic_store_seq_cst => @panic("TODO try self.airAtomicStore(inst, .seq_cst)"), .struct_field_ptr_index_0 => try self.airStructFieldPtrIndex(inst, 0), .struct_field_ptr_index_1 => try self.airStructFieldPtrIndex(inst, 1),