Skip to content
Snippets Groups Projects
Commit d7dbc882 authored by Tom Lane's avatar Tom Lane
Browse files

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 37de8de9 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 e5592c61, 89779bf2,
and 747ca669, 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.
parent b5450859
No related branches found
No related tags found
No related merge requests found
......@@ -53,7 +53,12 @@ extern slock_t dummy_spinlock;
/*
* icc defines __GNUC__, but doesn't support gcc's inline asm syntax
*/
#if defined(__ia64__) || defined(__ia64)
#define pg_memory_barrier() __mf()
#elif defined(__i386__) || defined(__x86_64__)
#define pg_memory_barrier() _mm_mfence()
#endif
#define pg_compiler_barrier() __memory_barrier()
#elif defined(__GNUC__)
......@@ -112,8 +117,12 @@ extern slock_t dummy_spinlock;
* read barrier to cover that case. We might need to add that later.
*/
#define pg_memory_barrier() __asm__ __volatile__ ("mb" : : : "memory")
#define pg_read_barrier() __asm__ __volatile__ ("rmb" : : : "memory")
#define pg_read_barrier() __asm__ __volatile__ ("mb" : : : "memory")
#define pg_write_barrier() __asm__ __volatile__ ("wmb" : : : "memory")
#elif defined(__hppa) || defined(__hppa__) /* HP PA-RISC */
/* HPPA doesn't do either read or write reordering */
#define pg_memory_barrier() pg_compiler_barrier()
#elif __GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1)
/*
......@@ -148,7 +157,7 @@ extern slock_t dummy_spinlock;
* fence. But all of our actual implementations seem OK in this regard.
*/
#if !defined(pg_memory_barrier)
#define pg_memory_barrier(x) \
#define pg_memory_barrier() \
do { S_LOCK(&dummy_spinlock); S_UNLOCK(&dummy_spinlock); } while (0)
#endif
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment