diff options
author | Andres Freund <andres@anarazel.de> | 2014-10-25 10:27:41 +0200 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2014-10-25 11:11:39 +0200 |
commit | 4a54b99e9c3989017fa5717f343cceab09aa5542 (patch) | |
tree | 2cab1e008d246df38024eea50f5d7e9eb1c3d58c /src | |
parent | db29620d4d16e08241f965ccd70d0f65883ff0de (diff) | |
download | postgresql-4a54b99e9c3989017fa5717f343cceab09aa5542.tar.gz postgresql-4a54b99e9c3989017fa5717f343cceab09aa5542.zip |
Add native compiler and memory barriers for solaris studio.
Discussion: 20140925133459.GB9633@alap3.anarazel.de
Author: Oskari Saarenmaa
Diffstat (limited to 'src')
-rw-r--r-- | src/include/pg_config.h.in | 3 | ||||
-rw-r--r-- | src/include/port/atomics/generic-sunpro.h | 22 |
2 files changed, 25 insertions, 0 deletions
diff --git a/src/include/pg_config.h.in b/src/include/pg_config.h.in index ddcf4b07173..3e78d65dd7a 100644 --- a/src/include/pg_config.h.in +++ b/src/include/pg_config.h.in @@ -340,6 +340,9 @@ /* Define to 1 if `long long int' works and is 64 bits. */ #undef HAVE_LONG_LONG_INT_64 +/* Define to 1 if you have the <mbarrier.h> header file. */ +#undef HAVE_MBARRIER_H + /* Define to 1 if you have the `mbstowcs_l' function. */ #undef HAVE_MBSTOWCS_L diff --git a/src/include/port/atomics/generic-sunpro.h b/src/include/port/atomics/generic-sunpro.h index 77d3ebe0031..5367a63fdbc 100644 --- a/src/include/port/atomics/generic-sunpro.h +++ b/src/include/port/atomics/generic-sunpro.h @@ -19,6 +19,28 @@ #if defined(HAVE_ATOMICS) +#ifdef HAVE_MBARRIER_H +#include <mbarrier.h> + +#define pg_compiler_barrier_impl() __compiler_barrier() + +#ifndef pg_memory_barrier_impl +# define pg_memory_barrier_impl() __machine_rw_barrier() +#endif +#ifndef pg_read_barrier_impl +/* + * Despite the name this is actually a full barrier. Expanding to mfence and + * membar #StoreStore | #LoadStore | #StoreLoad | #LoadLoad on x86/sparc + * respectively. + */ +# define pg_read_barrier_impl() __machine_r_barrier() +#endif +#ifndef pg_write_barrier_impl +# define pg_write_barrier_impl() __machine_w_barrier() +#endif + +#endif /* HAVE_MBARRIER_H */ + /* Older versions of the compiler don't have atomic.h... */ #ifdef HAVE_ATOMIC_H |