mirror of
https://github.com/zebrajr/postgres.git
synced 2025-12-07 12:20:31 +01:00
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 commit37de8de9egot 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 commitse5592c61a,89779bf2c, and747ca6697, 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.
This commit is contained in:
parent
b54508596d
commit
d7dbc882d3
|
|
@ -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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user