libstdc++/4150: catastrophic performance decrease in C++ code

Jason Merrill jason@redhat.com
Thu Apr 18 03:06:00 GMT 2002


The following reply was made to PR libstdc++/4150; it has been noted by GNATS.

From: Jason Merrill <jason@redhat.com>
To: bkoz@redhat.com
Cc: libstdc++@gcc.gnu.org, gcc-gnats@gcc.gnu.org
Subject: Re: libstdc++/4150: catastrophic performance decrease in C++ code
Date: Thu, 18 Apr 2002 11:01:54 +0100

 --=-=-=
 
 >>>>> "Benjamin" == Benjamin Kosnik <bkoz@redhat.com> writes:
 
 >> A problem with the current implementation of this is that if we do a
 >> read on an input/output filebuf, we end up writing the contents of the
 >> buffer back out to the file, even if we've never requested a write. 
 >> Oops.
 
 > Hmmm.
 
 > Please write a testcase that demonstrates this, and add it to
 > 27_io/filebuf_members.cc
 
 I'm not sure how to check for this without strace...thoughts?
 
 >> I feel like I know my way around streambufs a lot better now.
 
 > Great. So, how do you like debugging C++ with the current tools?
 > Painful, huh? Does it make you feel psychic when you fix things?
 
 > Please let me know if you have any special kung-fu to pass on.
 
 1) When I started adding -static to my links, the random gdb crashes went
    away.
 2) Sometimes 'step' fails to step into a function, but 'stepi' always seems
    to work; once I'm into the function, I can start using 'step' again.
 3) The patch below fixes inspection of class contents.
 
 >> Tested i686-pc-linux-gnu, no regressions.  Any objections?
 
 > Mainline and branch have diverged a bit right now. Did you test with
 > branch or mainline?
 
 trunk.  I'll test on the branch, too.
 
 > I need to get solaris back in shape on mainline: bsd's, hpux, aix,
 > cygwin are all back in shape now, but solaris is still kind of dicy. I'm
 > going to ask you to hold off, at least on the branch, till I have the
 > libstdc++/4164 patch integrated. Also, you'll need to do the testsuite
 > entry before you can check in. Okay?
 
 I can hold off a bit; let me know.
 
 > Does this mean that the FSEEK hacks in config/os/*/bits/os_defines.h can
 > be removed, since this define is no longer used?
 
 Yep.
 
 Jason
 
 
 --=-=-=
 Content-Type: text/x-patch
 Content-Disposition: inline
 
 *** gnu-v3-abi.c.~1~	Sun Mar 17 17:10:01 2002
 --- gnu-v3-abi.c	Sun Apr 14 22:59:39 2002
 *************** gnuv3_rtti_type (struct value *value,
 *** 241,262 ****
     vtable_symbol_name = SYMBOL_DEMANGLED_NAME (vtable_symbol);
     if (vtable_symbol_name == NULL
         || strncmp (vtable_symbol_name, "vtable for ", 11))
 !     error ("can't find linker symbol for virtual table for `%s' value",
 !            TYPE_NAME (value_type));
     class_name = vtable_symbol_name + 11;
   
     /* Try to look up the class name as a type name.  */
     class_symbol = lookup_symbol (class_name, 0, STRUCT_NAMESPACE, 0, 0);
     if (! class_symbol)
 !     error ("can't find class named `%s', as given by C++ RTTI", class_name);
   
     /* Make sure the type symbol is sane.  (An earlier version of this
        code would find constructor functions, who have the same name as
        the class.)  */
     if (SYMBOL_CLASS (class_symbol) != LOC_TYPEDEF
         || TYPE_CODE (SYMBOL_TYPE (class_symbol)) != TYPE_CODE_CLASS)
 !     error ("C++ RTTI gives a class name of `%s', but that isn't a type name",
 !            class_name);
   
     /* This is the object's run-time type!  */
     run_time_type = SYMBOL_TYPE (class_symbol);
 --- 241,273 ----
     vtable_symbol_name = SYMBOL_DEMANGLED_NAME (vtable_symbol);
     if (vtable_symbol_name == NULL
         || strncmp (vtable_symbol_name, "vtable for ", 11))
 !     {
 !       warning ("can't find linker symbol for virtual table for `%s' value",
 ! 	       TYPE_NAME (value_type));
 !       if (vtable_symbol_name)
 ! 	warning ("  found `%s' instead", vtable_symbol_name);
 !       return NULL;
 !     }
     class_name = vtable_symbol_name + 11;
   
     /* Try to look up the class name as a type name.  */
     class_symbol = lookup_symbol (class_name, 0, STRUCT_NAMESPACE, 0, 0);
     if (! class_symbol)
 !     {
 !       warning ("can't find class named `%s', as given by C++ RTTI", class_name);
 !       return NULL;
 !     }
   
     /* Make sure the type symbol is sane.  (An earlier version of this
        code would find constructor functions, who have the same name as
        the class.)  */
     if (SYMBOL_CLASS (class_symbol) != LOC_TYPEDEF
         || TYPE_CODE (SYMBOL_TYPE (class_symbol)) != TYPE_CODE_CLASS)
 !     {
 !       warning ("C++ RTTI gives a class name of `%s', but that isn't a type name",
 ! 	       class_name);
 !       return NULL;
 !     }
   
     /* This is the object's run-time type!  */
     run_time_type = SYMBOL_TYPE (class_symbol);
 
 --=-=-=--



More information about the Gcc-prs mailing list