This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH][C++] Fix PR29433, make C++ use a lot less time/memory
- From: Richard Guenther <rguenther at suse dot de>
- To: Michael Matz <matz at suse dot de>
- Cc: Mark Mitchell <mark at codesourcery dot com>, Daniel Jacobowitz <drow at false dot org>, Gabriel Dos Reis <gdr at cs dot tamu dot edu>, gcc-patches at gcc dot gnu dot org
- Date: Tue, 20 Feb 2007 15:53:38 +0100 (CET)
- Subject: Re: [PATCH][C++] Fix PR29433, make C++ use a lot less time/memory
- References: <457D726E.7060905@redhat.com> <Pine.LNX.4.64.0612111628100.3105@zhemvz.fhfr.qr> <Pine.GSO.4.58.0612110926270.19022@sun> <Pine.LNX.4.64.0612111635030.3105@zhemvz.fhfr.qr> <457D7AB1.10706@redhat.com> <Pine.LNX.4.64.0612111647520.3105@zhemvz.fhfr.qr> <20061211155733.GA2660@nevyn.them.org> <Pine.LNX.4.64.0612111658590.29962@wotan.suse.de> <20061211174548.GA7094@nevyn.them.org> <Pine.LNX.4.64.0612121519200.29962@wotan.suse.de> <20061212150652.GA18750@nevyn.them.org> <Pine.LNX.4.64.0612121723070.29962@wotan.suse.de> <457EF130.5040902@codesourcery.com> <Pine.LNX.4.64.0612131535100.29962@wotan.suse.de> <4580405A.4000109@codesourcery.com> <Pine.LNX.4.64.0702201500170.25448@wotan.suse.de>
On Tue, 20 Feb 2007, Michael Matz wrote:
> Hi,
>
> On Wed, 13 Dec 2006, Mark Mitchell wrote:
>
> > Nobody is arguing that DW_AT_name should be the huge string for the long
> > term. However, I would argue that it should stay that huge string until
> > we add the template arguments to debug info, and until GDB understands
> > that information.
>
> Okay, so the attached patch does that. On the testcase from PR29433 it
> has these results (on x86_64, but with -m32):
>
> trunk, -O0, total: 1403994 kB (3:00 min)
> patched, -O0, total: 353658 kB (1:11 min)
> trunk, -O0 -g, total: 2539302 kB (3:17 min)
> patched, -O0 -g, total: 1668378 kB (2:32 min)
>
> So it saves between 900MB and 1.1 GB :) [It also saves memory with -g
> because the strings are ggc_stddup'd again] I've removed the hand-crafted
> mangle_class_name_for_template and classtype_mangled_name functions and
> instead used the diagnostics machinery for real by not simply looking at
> DECL_NAME of a type (in dwarf2out), but instead use the dwarf_name
> langhook there. In C that will be equivalent to using DECL_NAME in C++ it
> will call cxx_printable_name, which prints nice (long) names for
> complicated types. The verbosity needs to be 2 for that, and instead of
> adding yet another langhook or wrapper function which is called just once,
> I've called it directly.
I noticed dwarf_name is mapped to decl_printable_name for C++ and
we can gain another xstrdup/free if we implement the dwarf_name
langhook for C++ by simply using cp/error.c:lang_decl_name. This way
we avoid using the cxx_printable_name ring buffer for function decls.
This might shave off a few seconds in compile time and a few bytes
off peak memory usage.
Richard.