public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: hjl@lucon.org (H.J. Lu)
To: khan@xraylith.wisc.edu (Mumit Khan)
Cc: egcs@cygnus.com, drepper@cygnus.com (Ulrich Drepper)
Subject: A STL patch for egcs 1.0.2
Date: Wed, 18 Feb 1998 14:54:00 -0000	[thread overview]
Message-ID: <m0y5H5T-00058KC@ocean.lucon.org> (raw)
In-Reply-To: <9802180511.AA18538@modi.xraylith.wisc.edu>

> 
> Jason Merrill <jason@cygnus.com> writes:
> > 
> > I suppose we should resurrect sinst.h.
> > 
> 
> Please do. I'd rather not see 1.0.2 released with the current scheme.
> I just built a moderately large project hat went up 20% in disk usage 
> and also about ~15% in link time on ELF, and on sparc-sunso4.1.3, the 
> results were much worse both in time and space.
> 

Ulrich, this will make STL thread-safe for glibc 2 and at the same
time, the non-thread code should be ok. Can you take a look? libstdc++
in egcs 1.0.2 should be fixed for glibc 2.

Thanks.


-- 
H.J. Lu (hjl@gnu.org)
---
Wed Jan 14 16:15:05 1998  H.J. Lu  (hjl@gnu.org)

	* ropeimpl.h: Include <stl_config.h>.
	* stl_alloc.h: Ditto.
	* stl_rope.h: Ditto.

	* ropeimpl.h (__STL_PTHREADS_ENABLED): Check
	__STL_PTHREADS_ENABLED instead of _PTHREADS.
	* stl_alloc.h: Ditto.
	* stl_config.h: Ditto.
	* stl_rope.h: Ditto.

	* stl_config.h: include <_G_config.h> if __GNUG__ is defined.
	(__STL_PTHREADS_ENABLED): Defined if _PTHREADS is defined or
	__GLIBC__ >= 2.

Index: ropeimpl.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libstdc++/stl/ropeimpl.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 ropeimpl.h
--- ropeimpl.h	1997/11/06 16:57:29	1.1.1.3
+++ ropeimpl.h	1998/01/14 23:59:43
@@ -17,6 +17,7 @@
 
 # include <stdio.h>
 # include <iostream.h>
+# include <stl_config.h>
 
 __STL_BEGIN_NAMESPACE
 
@@ -1429,7 +1430,7 @@
 
 template<class charT, class Alloc> charT rope<charT,Alloc>::empty_c_str[1];
 
-# ifdef _PTHREADS
+# ifdef __STL_PTHREADS_ENABLED
     template<class charT, class Alloc>
     pthread_mutex_t rope<charT,Alloc>::swap_lock = PTHREAD_MUTEX_INITIALIZER;
 # endif
Index: stl_alloc.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libstdc++/stl/stl_alloc.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 stl_alloc.h
--- stl_alloc.h	1997/11/06 16:57:30	1.1.1.1
+++ stl_alloc.h	1998/01/15 00:00:08
@@ -57,16 +57,17 @@
 #include <stdlib.h>
 #include <string.h>
 #include <assert.h>
+#include <stl_config.h>
 #ifndef __RESTRICT
 #  define __RESTRICT
 #endif
 
-#if !defined(_PTHREADS) && !defined(_NOTHREADS) \
+#if !defined(__STL_PTHREADS_ENABLED) && !defined(_NOTHREADS) \
  && !defined(__STL_SGI_THREADS) && !defined(__STL_WIN32THREADS)
 #   define _NOTHREADS
 #endif
 
-# ifdef _PTHREADS
+# ifdef __STL_PTHREADS_ENABLED
     // POSIX Threads
     // This is dubious, since this is likely to be a high contention
     // lock.   Performance may not be adequate.
@@ -357,7 +358,7 @@
     static inline void __unlock(volatile unsigned long *);
 # endif
 
-# ifdef _PTHREADS
+# ifdef __STL_PTHREADS_ENABLED
     static pthread_mutex_t __node_allocator_lock;
 # endif
 
@@ -558,7 +559,7 @@
     return(result);
 }
 
-#ifdef _PTHREADS
+#ifdef __STL_PTHREADS_ENABLED
     template <bool threads, int inst>
     pthread_mutex_t
     __default_alloc_template<threads, inst>::__node_allocator_lock
Index: stl_config.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libstdc++/stl/stl_config.h,v
retrieving revision 1.1.1.3
diff -u -r1.1.1.3 stl_config.h
--- stl_config.h	1997/11/06 16:57:28	1.1.1.3
+++ stl_config.h	1998/01/15 00:00:38
@@ -71,6 +71,15 @@
 //  (19) Defines __stl_assert either as a test or as a null macro,
 //       depending on whether or not __STL_ASSERTIONS is defined.
 
+#ifdef __GNUG__
+#include <_G_config.h>
+#endif
+
+#if !defined(__STL_PTHREADS_ENABLED) && (defined(_PTHREADS) \
+ || (defined(__GLIBC__) && __GLIBC__ >= 2))
+#   define __STL_PTHREADS_ENABLED
+#endif
+
 # if defined(__sgi) && !defined(__GNUC__)
 #   if !defined(_BOOL)
 #     define __STL_NEED_BOOL
@@ -93,7 +102,7 @@
 #   if (_COMPILER_VERSION >= 721) && defined(_NAMESPACES)
 #     define __STL_USE_NAMESPACES
 #   endif 
-#   if !defined(_NOTHREADS) && !defined(_PTHREADS)
+#   if !defined(_NOTHREADS) && !defined(__STL_PTHREADS_ENABLED)
 #     define __STL_SGI_THREADS
 #   endif
 # endif
Index: stl_rope.h
===================================================================
RCS file: /home/work/cvs/gnu/egcs/libstdc++/stl/stl_rope.h,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 stl_rope.h
--- stl_rope.h	1997/11/06 16:57:31	1.1.1.1
+++ stl_rope.h	1998/01/15 00:01:48
@@ -18,6 +18,8 @@
 #ifndef __SGI_STL_INTERNAL_ROPE_H
 # define __SGI_STL_INTERNAL_ROPE_H
 
+# include <stl_config.h>
+
 # ifdef __GC
 #   define __GC_CONST const
 # else
@@ -306,7 +308,7 @@
             {
                 return InterlockedDecrement(&refcount);
             }
-#	elif defined(_PTHREADS)
+#	elif defined(__STL_PTHREADS_ENABLED)
 	    // This should be portable, but performance is expected
 	    // to be quite awful.  This really needs platform specific
 	    // code.
@@ -939,7 +941,7 @@
 	    static cstrptr atomic_swap(cstrptr *p, cstrptr q) {
 		return (cstrptr) InterlockedExchange((LPLONG)p, (LONG)q);
 	    }
-#	elif defined(_PTHREADS)
+#	elif defined(__STL_PTHREADS_ENABLED)
 	    // This should be portable, but performance is expected
 	    // to be quite awful.  This really needs platform specific
 	    // code.

  parent reply	other threads:[~1998-02-18 14:54 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-02-17  9:51 (1.0.2) std/bastring.h change -- Why add std/bastring.cc? Mumit Khan
1998-02-17 10:40 ` Joe Buck
     [not found] ` <199802171840.KAA06006.cygnus.egcs@atrus.synopsys.com>
1998-02-17 13:54   ` Jason Merrill
1998-02-17 15:16     ` H.J. Lu
1998-02-17 23:59     ` Mumit Khan
1998-02-18 14:54       ` H.J. Lu
1998-02-18 14:54       ` H.J. Lu [this message]
     [not found]       ` <m0y5H2p-00058KC.cygnus.egcs@ocean.lucon.org>
1998-02-19 10:45         ` Jason Merrill
     [not found]       ` <m0y5H5T-00058KC.cygnus.egcs@ocean.lucon.org>
1998-02-19 10:47         ` A STL patch for egcs 1.0.2 Jason Merrill
1998-02-19 10:47           ` H.J. Lu
1998-02-19 12:42             ` Jason Merrill
1998-02-20 12:26               ` H.J. Lu
1998-02-20 12:26                 ` Jason Merrill
1998-02-20 12:26                   ` H.J. Lu
1998-02-20 11:09                     ` Jason Merrill
1998-02-19 14:09           ` Ulrich Drepper
1998-02-22 16:39             ` Jeffrey A Law
1998-02-23 11:00               ` H.J. Lu
1998-02-23  9:19                 ` Jeffrey A Law

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m0y5H5T-00058KC@ocean.lucon.org \
    --to=hjl@lucon.org \
    --cc=drepper@cygnus.com \
    --cc=egcs@cygnus.com \
    --cc=khan@xraylith.wisc.edu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).