Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitebd38e3

Browse files
committed
Allow MEMSET_LOOP_LIMIT to be set on a per-platform basis, and turn off
MemSet on AIX by setting MEMSET_LOOP_LIMIT to zero.Add optimization to skip MemSet tests in MEMSET_LOOP_LIMIT == 0 case andjust call memset() directly.
1 parent59bb147 commitebd38e3

File tree

5 files changed

+37
-9
lines changed

5 files changed

+37
-9
lines changed

‎configure

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21516,6 +21516,17 @@ _ACEOF
2151621516
SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
2151721517

2151821518

21519+
# If not set in template file, set bytes to use libc memset()
21520+
if test x"$MEMSET_LOOP_LIMIT" = x"" ; then
21521+
MEMSET_LOOP_LIMIT=1024
21522+
fi
21523+
21524+
cat >>confdefs.h <<_ACEOF
21525+
#define MEMSET_LOOP_LIMIT ${MEMSET_LOOP_LIMIT}
21526+
_ACEOF
21527+
21528+
21529+
2151921530
if test "$enable_nls" = yes ; then
2152021531

2152121532
echo "$as_me:$LINENO: checking for library containing gettext" >&5

‎configure.in

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
dnl Process this file with autoconf to produce a configure script.
2-
dnl $PostgreSQL: pgsql/configure.in,v 1.443 2006/01/17 23:52:30 tgl Exp $
2+
dnl $PostgreSQL: pgsql/configure.in,v 1.444 2006/02/03 13:53:15 momjian Exp $
33
dnl
44
dnl Developers, please strive to achieve this order:
55
dnl
@@ -1249,6 +1249,13 @@ AC_DEFINE(USE_SYSV_SHARED_MEMORY, 1, [Define to select SysV-style shared memory.
12491249
SHMEM_IMPLEMENTATION="src/backend/port/sysv_shmem.c"
12501250

12511251

1252+
# If not set in template file, set bytes to use libc memset()
1253+
if test x"$MEMSET_LOOP_LIMIT" = x"" ; then
1254+
MEMSET_LOOP_LIMIT=1024
1255+
fi
1256+
AC_DEFINE_UNQUOTED(MEMSET_LOOP_LIMIT, ${MEMSET_LOOP_LIMIT}, [Define bytes to use libc memset().])
1257+
1258+
12521259
if test "$enable_nls" = yes ; then
12531260
PGAC_CHECK_GETTEXT
12541261
fi

‎src/include/c.h

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* Portions Copyright (c) 1996-2005, PostgreSQL Global Development Group
1313
* Portions Copyright (c) 1994, Regents of the University of California
1414
*
15-
* $PostgreSQL: pgsql/src/include/c.h,v 1.194 2006/01/05 03:01:37 momjian Exp $
15+
* $PostgreSQL: pgsql/src/include/c.h,v 1.195 2006/02/03 13:53:15 momjian Exp $
1616
*
1717
*-------------------------------------------------------------------------
1818
*/
@@ -614,9 +614,7 @@ typedef NameData *Name;
614614
*overhead.However, we have also found that the loop is faster than
615615
*native libc memset() on some platforms, even those with assembler
616616
*memset() functions. More research needs to be done, perhaps with
617-
*platform-specific MEMSET_LOOP_LIMIT values or tests in configure.
618-
*
619-
*bjm 2002-10-08
617+
*MEMSET_LOOP_LIMIT tests in configure.
620618
*/
621619
#defineMemSet(start,val,len) \
622620
do \
@@ -629,7 +627,12 @@ typedef NameData *Name;
629627
if ((((long)_vstart)&INT_ALIGN_MASK)==0&& \
630628
(_len&INT_ALIGN_MASK)==0&& \
631629
_val==0&& \
632-
_len <= MEMSET_LOOP_LIMIT) \
630+
_len <=MEMSET_LOOP_LIMIT&& \
631+
/* \
632+
*If MEMSET_LOOP_LIMIT == 0, optimizer should find \
633+
*the whole "if" false at compile time. \
634+
*/ \
635+
MEMSET_LOOP_LIMIT!=0) \
633636
{ \
634637
int32*_start= (int32*)_vstart; \
635638
int32*_stop= (int32*) ((char*)_start+_len); \
@@ -640,8 +643,6 @@ typedef NameData *Name;
640643
memset(_vstart,_val,_len); \
641644
}while (0)
642645

643-
#defineMEMSET_LOOP_LIMIT 1024
644-
645646
/*
646647
* MemSetAligned is the same as MemSet except it omits the test to see if
647648
* "start" is word-aligned. This is okay to use if the caller knows a-priori
@@ -657,7 +658,8 @@ typedef NameData *Name;
657658
\
658659
if ((_len & INT_ALIGN_MASK) == 0 && \
659660
_val == 0 && \
660-
_len <= MEMSET_LOOP_LIMIT) \
661+
_len <= MEMSET_LOOP_LIMIT && \
662+
MEMSET_LOOP_LIMIT != 0) \
661663
{ \
662664
int32 *_stop = (int32 *) ((char *) _start + _len); \
663665
while (_start < _stop) \
@@ -679,6 +681,7 @@ typedef NameData *Name;
679681
#defineMemSetTest(val,len) \
680682
( ((len) & INT_ALIGN_MASK) == 0 && \
681683
(len) <= MEMSET_LOOP_LIMIT && \
684+
MEMSET_LOOP_LIMIT != 0 && \
682685
(val) == 0 )
683686

684687
#defineMemSetLoop(start,val,len) \

‎src/include/pg_config.h.in

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,9 @@
576576
/* Define as the maximum alignment requirement of any C data type. */
577577
#undef MAXIMUM_ALIGNOF
578578

579+
/* Define bytes to use libc memset(). */
580+
#undef MEMSET_LOOP_LIMIT
581+
579582
/* Define to the address where bug reports for this package should be sent. */
580583
#undef PACKAGE_BUGREPORT
581584

‎src/template/aix

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,7 @@ if test "$GCC" != yes ; then
88
;;
99
esac
1010
fi
11+
12+
# native memset() is faster, 2006-02-03
13+
# XLC 6.0, (IBM's cc), tested on AIX 5.2 and 5.1
14+
MEMSET_LOOP_LIMIT=0

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp