You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit d8a5164
Browse filesBrowse the repository at this point in the historyBrowse files
[NOT FOR MERGE... yet.] Remove traditional atomics; use C11 stdatomic.h exclusively
*** NOT FOR MERGE in this cycle. ***
This commit is included to show the intended long-term destination of the
series, and to let reviewers and the buildfarm exercise the stdatomic-only
end state -- but it is deliberately NOT proposed for commit yet. The plan is
to ship the earlier patches (which add C11 <stdatomic.h> as a *selectable*
implementation alongside the traditional platform-specific code), let the
stdatomic path prove itself in the field across the buildfarm and at least one
release, and only THEN remove the traditional implementation via a commit like
this one. Removing the battle-tested arch-*/generic-* code on day one is not
being asked for here; keeping both paths until stdatomic has earned trust is.
Everything below describes what this (eventual) removal commit does.
This collapses the dual-path atomics into a single stdatomic-only
implementation, mirroring the destination state of the series. Rather
than selecting between C11 <stdatomic.h> and the platform-specific
implementations at build time, stdatomic.h is now the sole backend for
PostgreSQL's atomic operations and USE_STDATOMIC_H is effectively
always-on.
The platform-specific implementation files are deleted outright:
- src/include/port/atomics/arch-arm.h
- src/include/port/atomics/arch-ppc.h
- src/include/port/atomics/arch-x86.h
- src/include/port/atomics/generic.h
- src/include/port/atomics/generic-gcc.h
- src/include/port/atomics/generic-msvc.h
- src/include/port/atomics/fallback.h
atomics.h drops its #ifdef USE_STDATOMIC_H / #else conditional and the
now-dead includes of the arch-*/generic-*/fallback headers, keeping only
the stdatomic_impl.h include and the common public-API layer of static
inline pg_atomic_* wrappers. storage/spin.h and s_lock.c lose their
traditional-spinlock (#else) branches, so only the pg_atomic_flag-based
spinlock path remains; the s_lock.h includes that served only that path
are removed.
Detection is retained but now hard-errors when a working C11
stdatomic.h is unavailable, in both meson.build and configure.ac,
instead of silently falling back.
The only remaining hand-written platform hint is the CPU spin-delay
instruction in src/include/port/spin_delay.h, which stdatomic.h does not
cover; it is intentionally left in place along with spin_delay_status.h
and stdatomic_impl.h.
This depends on the prior commits in the series (build-time detection,
stdatomic_impl.h, conditional wire-up, documentation, and the
test_atomics module).
Co-authored-by: Thomas Munro <tmunro@postgresql.org>
0 commit comments