gcc speedup patch

Ulrich Drepper drepper@cygnus.com
Wed Dec 2 11:46:00 GMT 1998


Hi,

Is it ok to install the appended patch?  It should speed up the
compiler itself on platforms with stdio implementations which are by
default thread safe (such as Linux).

-- 
---------------.      drepper at gnu.org  ,-.   1325 Chesapeake Terrace
Ulrich Drepper  \    ,-------------------'   \  Sunnyvale, CA 94089 USA
Cygnus Solutions `--' drepper at cygnus.com   `------------------------

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
1998-12-02  Ulrich Drepper  <drepper@cygnus.com>

	* configure.in: Test for availability of putc_unlocked, fputc_unlocked,
	and fputs_unlocked.
	* system.h: If the *_unlocked functions are available use them
	instead of the locked counterparts by defining macros.
	* config.in: Regenerated.

Index: config.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/config.in,v
retrieving revision 1.40
diff -d -u -p -r1.40 config.in
--- config.in	1998/11/23 16:39:36	1.40
+++ config.in	1998/12/02 18:51:33
@@ -140,6 +147,12 @@
 /* Define if you have the bzero function.  */
 #undef HAVE_BZERO
 
+/* Define if you have the fputc_unlocked function.  */
+#undef HAVE_FPUTC_UNLOCKED
+
+/* Define if you have the fputs_unlocked function.  */
+#undef HAVE_FPUTS_UNLOCKED
+
 /* Define if you have the getrlimit function.  */
 #undef HAVE_GETRLIMIT
 
@@ -157,6 +170,9 @@
 
 /* Define if you have the popen function.  */
 #undef HAVE_POPEN
+
+/* Define if you have the putc_unlocked function.  */
+#undef HAVE_PUTC_UNLOCKED
 
 /* Define if you have the putenv function.  */
 #undef HAVE_PUTENV
Index: configure.in
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/configure.in,v
retrieving revision 1.184
diff -d -u -p -r1.184 configure.in
--- configure.in	1998/11/28 10:00:03	1.184
+++ configure.in	1998/12/02 18:51:34
@@ -371,7 +371,8 @@ fi
 
 AC_CHECK_FUNCS(strtoul bsearch strerror putenv popen bcopy bzero bcmp \
 	index rindex strchr strrchr kill getrlimit setrlimit atoll atoq \
-	sysconf isascii gettimeofday strsignal)
+	sysconf isascii gettimeofday strsignal putc_unlocked fputc_unlocked \
+	fputs_unlocked)
 
 # Make sure wchar_t is available
 #AC_CHECK_TYPE(wchar_t, unsigned int)
Index: system.h
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/system.h,v
retrieving revision 1.21
diff -d -u -p -r1.21 system.h
--- system.h	1998/11/27 10:08:25	1.21
+++ system.h	1998/12/02 18:51:34
@@ -21,6 +21,21 @@
 #define NULL 0
 #endif
 
+/* The compiler is not a multi-threaded application and therefore we
+   do not have to use the locking functions.  */
+#ifdef HAVE_PUTC_UNLOCKED
+# undef putc
+# define putc(C, Stream) putc_unlocked (C, Stream)
+#endif
+#ifdef HAVE_FPUTC_UNLOCKED
+# undef fputc
+# define fputc(C, Stream) fputc_unlocked (C, Stream)
+#endif
+#ifdef HAVE_FPUTS_UNLOCKED
+# undef fputs
+# define fputs(String, Stream) fputs_unlocked (String, Stream)
+#endif
+
 #include <ctype.h>
 
 /* Jim Meyering writes:



More information about the Gcc-patches mailing list