SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
+# If not set in template file, set bytes to use libc memset()
+if test x"$MEMSET_LOOP_LIMIT" = x"" ; then
+ MEMSET_LOOP_LIMIT=1024
+fi
+
+cat >>confdefs.h <<_ACEOF
+#define MEMSET_LOOP_LIMIT ${MEMSET_LOOP_LIMIT}
+_ACEOF
+
+
+
if test "$enable_nls" = yes ; then
echo "$as_me:$LINENO: checking for library containing gettext" >&5
dnl Process this file with autoconf to produce a configure script.
-dnl $PostgreSQL: pgsql/configure.in,v 1.443 2006/01/17 23:52:30 tgl Exp $
+dnl $PostgreSQL: pgsql/configure.in,v 1.444 2006/02/03 13:53:15 momjian Exp $
dnl
dnl Developers, please strive to achieve this order:
dnl
SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
+# If not set in template file, set bytes to use libc memset()
+if test x"$MEMSET_LOOP_LIMIT" = x"" ; then
+ MEMSET_LOOP_LIMIT=1024
+fi
+AC_DEFINE_UNQUOTED(MEMSET_LOOP_LIMIT, ${MEMSET_LOOP_LIMIT}, [Define bytes to use libc memset().])
+
+
if test "$enable_nls" = yes ; then
PGAC_CHECK_GETTEXT
fi
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/include/c.h,v 1.194 2006/01/05 03:01:37 momjian Exp $
+ * $PostgreSQL: pgsql/src/include/c.h,v 1.195 2006/02/03 13:53:15 momjian Exp $
*
*-------------------------------------------------------------------------
*/
* overhead. However, we have also found that the loop is faster than
* native libc memset() on some platforms, even those with assembler
* memset() functions. More research needs to be done, perhaps with
- * platform-specific MEMSET_LOOP_LIMIT values or tests in configure.
- *
- * bjm 2002-10-08
+ * MEMSET_LOOP_LIMIT tests in configure.
*/
#define MemSet(start, val, len) \
do \
if ((((long) _vstart) & INT_ALIGN_MASK) == 0 && \
(_len & INT_ALIGN_MASK) == 0 && \
_val == 0 && \
- _len <= MEMSET_LOOP_LIMIT) \
+ _len <= MEMSET_LOOP_LIMIT && \
+ /* \
+ * If MEMSET_LOOP_LIMIT == 0, optimizer should find \
+ * the whole "if" false at compile time. \
+ */ \
+ MEMSET_LOOP_LIMIT != 0) \
{ \
int32 *_start = (int32 *) _vstart; \
int32 *_stop = (int32 *) ((char *) _start + _len); \
memset(_vstart, _val, _len); \
} while (0)
-#define MEMSET_LOOP_LIMIT 1024
-
/*
* MemSetAligned is the same as MemSet except it omits the test to see if
* "start" is word-aligned. This is okay to use if the caller knows a-priori
\
if ((_len & INT_ALIGN_MASK) == 0 && \
_val == 0 && \
- _len <= MEMSET_LOOP_LIMIT) \
+ _len <= MEMSET_LOOP_LIMIT && \
+ MEMSET_LOOP_LIMIT != 0) \
{ \
int32 *_stop = (int32 *) ((char *) _start + _len); \
while (_start < _stop) \
#define MemSetTest(val, len) \
( ((len) & INT_ALIGN_MASK) == 0 && \
(len) <= MEMSET_LOOP_LIMIT && \
+ MEMSET_LOOP_LIMIT != 0 && \
(val) == 0 )
#define MemSetLoop(start, val, len) \