Repository navigation
Use C++20 atomics for packed bit-vector helpers - #646
Merged
adamant-pwn merged 1 commit intoOct 11, 2026
Merged
Conversation
This was referenced Oct 11, 2026
adamant-pwn
marked this pull request as ready for review
October 11, 2026 17:03
adamant-pwn
force-pushed
the
codex/atomic-memory-orders
branch
from
October 11, 2026 17:06
0e9f586 to
0fde72c
Compare
There was a problem hiding this comment.
All reported issues were addressed
Reply to a comment to ask cubic a question or push back. It learns from your replies.
View guided diff | Turn on auto-fix | Re-trigger cubic
adamant-pwn
force-pushed
the
codex/atomic-memory-orders
branch
from
October 11, 2026 19:01
0fde72c to
b36b1d3
Compare
adamant-pwn
changed the base branch from
master
to
codex/cxx20-dependency-update
October 11, 2026 19:01
adamant-pwn
force-pushed
the
codex/atomic-memory-orders
branch
3 times, most recently
from
October 11, 2026 22:19
6228ec6 to
bad6d1d
Compare
adamant-pwn
added a commit
that referenced
this pull request
Oct 11, 2026
adamant-pwn
force-pushed
the
codex/atomic-memory-orders
branch
from
October 11, 2026 22:40
75c6e7a to
40a6222
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Use C++20 std::atomic_ref for packed bit-vector words and 64-bit differential counters. The bit-vector helpers accept std::memory_order directly, so the compiler-order conversion switch is removed. Keep the existing builtin operations for packed 8/16/32-bit counters; all counter call sites already use relaxed ordering, so their unused ordering parameter is removed.
A small load-only wrapper works around libc++ versions that cannot instantiate atomic_ref::load. The new header uses a project-prefixed guard. Extend concurrent coverage to both setting and clearing bits.
Validation: GCC, Clang and Clang/libc++ concurrency checks pass, as does UBSan. Before/after instruction lists match for 11 bit operations on each compiler (33 comparisons). Targeted translation units and the committed regression test pass. Full CI will rerun after restacking.
Stacked on #649. Review/merge order: #647 → #648 → #649 → #646 → #644.
Summary by cubic
Switches the packed bit-vector atomic helpers from compiler builtins and integer memory orders to
std::atomic_refwithstd::memory_order, since the implicit conversion between them breaks under C++20. A newutils::atomic_loadwrapper covers const access, which libc++'satomic_ref<const T>cannot instantiate.std::memory_order_*; external callers passing__ATOMIC_*constants must switch to the standard enum.atomic_fetchandatomic_fetch_and_adddropped their memory-order parameter and are always relaxed; 64-bit counters useatomic_refwhile 8/16/32-bit counters keep the builtin operations.Written for commit 40a6222. Summary will update on new commits.