Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commita011dc3

Browse files
committed
Require compiler barrier support.
Previously we had a fallback implementation of pg_compiler_barrier()that called an empty function across a translation unit boundary so thecompiler couldn't see what it did. That shouldn't be needed on anycurrent systems, and might not even work with a link time optimizer.Since we now require compiler-specific knowledge of how to implementatomics, we should also know how to implement compiler barriers on ahypothetical new system.Reviewed-by: Heikki Linnakangas <hlinnaka@iki.fi>Suggested-by: Andres Freund <andres@anarazel.de>Discussion:https://postgr.es/m/721bf39a-ed8a-44b0-8b8e-be3bd81db748%40technowledgy.deDiscussion:https://postgr.es/m/3351991.1697728588%40sss.pgh.pa.us
1 parent8138526 commita011dc3

File tree

3 files changed

+3
-23
lines changed

3 files changed

+3
-23
lines changed

‎src/backend/port/atomics.c‎

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,6 @@ pg_spinlock_barrier(void)
4040
}
4141
#endif
4242

43-
#ifdefPG_HAVE_COMPILER_BARRIER_EMULATION
44-
void
45-
pg_extern_compiler_barrier(void)
46-
{
47-
/* do nothing */
48-
}
49-
#endif
50-
5143

5244
#ifdefPG_HAVE_ATOMIC_U64_SIMULATION
5345

‎src/include/port/atomics.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -98,6 +98,9 @@
9898
#if !defined(PG_HAVE_ATOMIC_U32_SUPPORT)
9999
#error "could not find an implementation of pg_atomic_uint32"
100100
#endif
101+
#if !defined(pg_compiler_barrier_impl)
102+
#error "could not find an implementation of pg_compiler_barrier"
103+
#endif
101104

102105
/*
103106
* Provide a spinlock-based implementation of the 64 bit variants, if

‎src/include/port/atomics/fallback.h‎

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -33,21 +33,6 @@ extern void pg_spinlock_barrier(void);
3333
#definepg_memory_barrier_impl pg_spinlock_barrier
3434
#endif
3535

36-
#ifndefpg_compiler_barrier_impl
37-
/*
38-
* If the compiler/arch combination does not provide compiler barriers,
39-
* provide a fallback. The fallback simply consists of a function call into
40-
* an externally defined function. That should guarantee compiler barrier
41-
* semantics except for compilers that do inter translation unit/global
42-
* optimization - those better provide an actual compiler barrier.
43-
*
44-
* A native compiler barrier for sure is a lot faster than this...
45-
*/
46-
#definePG_HAVE_COMPILER_BARRIER_EMULATION
47-
externvoidpg_extern_compiler_barrier(void);
48-
#definepg_compiler_barrier_impl pg_extern_compiler_barrier
49-
#endif
50-
5136

5237
#if !defined(PG_HAVE_ATOMIC_U64_SUPPORT)
5338

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp