Add native compiler and memory barriers for solaris studio.
authorAndres Freund <andres@anarazel.de>
Sat, 25 Oct 2014 08:27:41 +0000 (10:27 +0200)
committerAndres Freund <andres@anarazel.de>
Sat, 25 Oct 2014 09:11:39 +0000 (11:11 +0200)
Discussion: 20140925133459.GB9633@alap3.anarazel.de
Author: Oskari Saarenmaa

configure
configure.in
src/include/pg_config.h.in
src/include/port/atomics/generic-sunpro.h

index b403a041727a22da8504d231b1478563105b540b..1248b06066e24ca68b618b0e5fd65796503a958a 100755 (executable)
--- a/configure
+++ b/configure
@@ -9164,7 +9164,7 @@ fi
 done
 
 
-for ac_header in atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
+for ac_header in atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h
 do :
   as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
 ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
index df868823c0cd5800c95b4b2e67ee30820907d0c9..0a3725fbbd1a025d3fa75a9be5e724f858a9a7d0 100644 (file)
@@ -1016,7 +1016,7 @@ AC_SUBST(UUID_LIBS)
 ##
 
 dnl sys/socket.h is required by AC_FUNC_ACCEPT_ARGTYPES
-AC_CHECK_HEADERS([atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h])
+AC_CHECK_HEADERS([atomic.h crypt.h dld.h fp_class.h getopt.h ieeefp.h ifaddrs.h langinfo.h mbarrier.h poll.h pwd.h sys/ioctl.h sys/ipc.h sys/poll.h sys/pstat.h sys/resource.h sys/select.h sys/sem.h sys/shm.h sys/socket.h sys/sockio.h sys/tas.h sys/time.h sys/un.h termios.h ucred.h utime.h wchar.h wctype.h])
 
 # On BSD, test for net/if.h will fail unless sys/socket.h
 # is included first.
index ddcf4b071739f48d22ffc15a9fcc04e345273784..3e78d65dd7a6fe0bb576487314c9a13542d24cc5 100644 (file)
 /* 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
 
index 77d3ebe0031cd0b1e8847d348d6527228d7e34fc..5367a63fdbc5c74b1e57817d9ce853e19ca6d0d6 100644 (file)
 
 #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