8000 Sync 9.2 and 9.3 versions of barrier.h with 9.4's version. · mayoor/postgres@f4f4f69 · GitHub
[go: up one dir, main page]

Skip to content

Commit f4f4f69

Browse files
committed
Sync 9.2 and 9.3 versions of barrier.h with 9.4's version.
We weren't particularly maintaining barrier.h before 9.4, because nothing was using it in those branches. Well, nothing until commit 37de8de got back-patched. That broke 9.2 and 9.3 for some non-mainstream platforms that we haven't been testing in the buildfarm, including icc on ia64, HPPA, and Alpha. This commit effectively back-patches commits e5592c6, 89779bf, and 747ca66, though I did it just by copying the file (less copyright date updates) rather than by cherry-picking those commits. Per an attempt to run gaur and pademelon over old branches they've not been run on since ~2013.
1 parent 6e53bb4 commit f4f4f69

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/include/storage/barrier.h

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,12 @@ extern slock_t dummy_spinlock;
5353
/*
5454
* icc defines __GNUC__, but doesn't support gcc's inline asm syntax
5555
*/
56+
#if defined(__ia64__) || defined(__ia64)
57+
#define pg_memory_barrier() __mf()
58+
#elif defined(__i386__) || defined(__x86_64__)
5659
#define pg_memory_barrier() _mm_mfence()
60+
#endif
61+
5762
#define pg_compiler_barrier() __memory_barrier()
5863
#elif defined(__GNUC__)
5964

@@ -112,8 +117,12 @@ extern slock_t dummy_spinlock;
112117
* read barrier to cover that case. We might need to add that later.
113118
*/
114119
#define pg_memory_barrier() __asm__ __volatile__ ("mb" : : : "memory")
115-
#define pg_read_barrier() __asm__ __volatile__ ("rmb" : : : "memory")
120+
#define pg_read_barrier() __asm__ __volatile__ ("mb" : : : "memory")
116121
#define pg_write_barrier() __asm__ __volatile__ ("wmb" : : : "memory")
122+
#elif defined(__hppa) || defined(__hppa__) /* HP PA-RISC */
123+
124+
/* HPPA doesn't do either read or write reordering */
125+
#define pg_memory_barrier() pg_compiler_barrier()
117126
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
118127

119128
/*
@@ -148,7 +157,7 @@ extern slock_t dummy_spinlock;
148157
* fence. But all of our actual implementations seem OK in this regard.
149158
*/
150159
#if !defined(pg_memory_barrier)
151-
#define pg_memory_barrier(x) \
160+
#define pg_memory_barrier() \
152161
do { S_LOCK(&dummy_spinlock); S_UNLOCK(&dummy_spinlock); } while (0)
153162
#endif
154163

0 commit comments

Comments
 (0)
0