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

Commitde6429a

Browse files
committed
Provide a generic fallback for pg_compiler_barrier using an extern function.
If the compiler/arch combination does not provide compiler barriers,provide a fallback. That fallback simply consists out of a functioncall into a externally defined function. That should guaranteecompiler barrierer semantics except for compilers that do intertranslation unit/global optimization - those better provide an actualcompiler barrier.Hopefully this fixes Tom's report of linker failures due topg_compiler_barrier_impl not being provided.I'm not backpatching this commit as it builds on the new atomicsinfrastructure. If we decide an equivalent fix needs to bebackpatched, I'll do so in a separate commit.Discussion: 27746.1420930690@sss.pgh.pa.usPer report from Tom Lane.
1 parentdb4ec2f commitde6429a

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

‎src/backend/port/atomics.c

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,14 @@ pg_spinlock_barrier(void)
3232
}
3333
#endif
3434

35+
#ifdefPG_HAVE_COMPILER_BARRIER_EMULATION
36+
void
37+
pg_extern_compiler_barrier(void)
38+
{
39+
/* do nothing */
40+
}
41+
#endif
42+
3543

3644
#ifdefPG_HAVE_ATOMIC_FLAG_SIMULATION
3745

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

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ extern void pg_spinlock_barrier(void);
3535
#definepg_memory_barrier_impl pg_spinlock_barrier
3636
#endif
3737

38+
#ifndefpg_compiler_barrier_impl
39+
/*
40+
* If the compiler/arch combination does not provide compiler barriers,
41+
* provide a fallback. That fallback simply consists out of a function call
42+
* into a externally defined function. That should guarantee compiler barrier
43+
* semantics except for compilers that do inter translation unit/global
44+
* optimization - those better provide an actual compiler barrier.
45+
*
46+
* Using a native compiler barrier for sure is a lot faster than this...
47+
*/
48+
#definePG_HAVE_COMPILER_BARRIER_EMULATION
49+
externvoidpg_extern_compiler_barrier(void);
50+
#definepg_compiler_barrier_impl pg_extern_compiler_barrier
51+
#endif
52+
53+
3854
/*
3955
* If we have atomics implementation for this platform fall back to providing
4056
* the atomics API using a spinlock to protect the internal state. Possibly

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp