Repository navigation
feat(libc): implement the remaining Dinkumware _Atomic helpers - #6334
Open
hypermoist wants to merge 1 commit into
Open
hypermoist wants to merge 1 commit into
hypermoist wants to merge 1 commit into
Conversation
The 1-, 2- and 8-byte loads, stores, exchanges, compare-exchanges and fetch operations, _Atomic_is_lock_free_N, the flag and fence functions and the lock-based generic _Atomic_copy, _Atomic_exchange and _Atomic_compare_exchange_*, matching the libc.prx bundled with PPSA08427 including its handling of invalid memory orders. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu
Progress report (34454bd → c0cf6e5)📈 System libraries: 88.86% (+0.15%, +48 implemented functions) ✅ 48 implemented
⚪ 5 behaviourally empty (constant return or throw)
|
This was referenced Oct 15, 2026
Closed
|
Some comparisons could not be completed because a pull request conflicts with the base branch. Review these shared files manually before concluding that there is no overlap.
|
This was referenced Oct 15, 2026
12 tasks done
This branch has not been deployed
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.
What
Implements the 48 Dinkumware
_Atomic_*helpers of the systemlibc.prxthat AnyPS5 did not have (it already had_Atomic_fetch_add_4,_Atomic_fetch_sub_4,_Atomic_compare_exchange_weak_4and_Atomic_load_4), in a newsrc/DinkumwareAtomics.cpp:_Atomic_store_N,_Atomic_load_N,_Atomic_exchange_N,_Atomic_compare_exchange_{strong,weak}_N,_Atomic_fetch_{add,sub,and,or,xor}_N(the sizes missing upstream)_Atomic_is_lock_free_{1,2,4,8},_Atomic_flag_test_and_set,_Atomic_flag_clear,_Atomic_thread_fence,_Atomic_signal_fence_Atomic_copy,_Atomic_exchange,_Atomic_compare_exchange_strongand_Atomic_compare_exchange_weak, which take a byte spinlock flag and a size, lock the flag,memcmp/copy the bytes and unlock, as on the consoleEvery operation is sequentially consistent whatever memory order it is given, never weaker than the console. The
libc.prxbundled with PPSA08427 has observable quirks for unusual orders, which are reproduced:_Atomic_load_8returns 0 for release, acq_rel or an invalid order, and the 8-byte exchange and fetch operations return 0 without touching memory for an order abovememory_order_seq_cst. Recorded indocs/dev/debt/libc.md.Tested
Linux (CachyOS, GCC Release build, plus a clang
-Wall -Wextrasyntax check): newguest_dinkumware_atomicstest (each family, the order quirks, the flag, the generic functions, and two threads updating a 24-byte object through the locked compare-exchange) passes, as doesguest_libc_threads.tools/check_conventions.pypasses;tools/pr_overlap.py --branchreports no line overlap.Differential test against the console: the PPSA08427
libc.prxwas mapped into a Linux process and every function here was run side by side with this implementation on random values with every memory order from 0 to 7 (stores only with valid orders, since the console's store falls off its jump table otherwise), and the generic functions on sizes 1 to 40 with equal and unequal expected values; return values, targets, expected buffers and lock flags agree everywhere.Checklist
main; no other open PR implements the same functionsNotImplemented_nid_no_patch); silent stubs are listed under Silent stubs in their library's technical debt file.mdfiles or images added to the repository (attach them to this PR)🤖 Generated with Claude Code
https://claude.ai/code/session_01Q8tinbP1MUpUaDsbNWnGnu