This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: C++ demangler fix
- From: Jakub Jelinek <jakub at redhat dot com>
- To: gcc-patches at gcc dot gnu dot org, DJ Delorie <dj at redhat dot com>, Ian Lance Taylor <ian at airs dot com>
- Date: Wed, 11 Sep 2013 14:59:33 +0200
- Subject: Re: C++ demangler fix
- Authentication-results: sourceware.org; auth=none
- References: <20130904142943 dot GA18972 at blade dot nx> <20130910153400 dot GC1817 at tucnak dot redhat dot com> <20130911124946 dot GA9897 at blade dot nx>
- Reply-to: Jakub Jelinek <jakub at redhat dot com>
On Wed, Sep 11, 2013 at 01:49:46PM +0100, Gary Benson wrote:
> Jakub Jelinek wrote:
> > cp-demangle.c isn't used just in libiberty, where using hashtab,
> > xcalloc, XNEW etc. is fine, but also in libsupc++/libstdc++, where
> > none of that is fine. That is why cp-demangle.c only uses
> > e.g. realloc, checks for allocation failures and propagates those to
> > the caller if they happen (see allocation_failure field). hashtab.o
> > isn't linked into libstdc++ nor libsupc++, and the question is if we
> > really do want to link all the hashtable code into libstdc++.
> > How many hash table entries are there typically? Is a hashtable
> > required?
>
> Three entries were required for the symbol in the testcase:
>
> "_ZSt7forwardIRN1x14refobjiteratorINS0_3refINS0_4mime30multipart_se" \
> "ction_processorObjIZ15get_body_parserIZZN14mime_processor21make_se" \
> "ction_iteratorERKNS2_INS3_10sectionObjENS0_10ptrrefBaseEEEbENKUlvE" \
> "_clEvEUlSB_bE_ZZNS6_21make_section_iteratorESB_bENKSC_clEvEUlSB_E0" \
> "_ENS1_INS2_INS0_20outputrefiteratorObjIiEES8_EEEERKSsSB_OT_OT0_EUl" \
> "mE_NS3_32make_multipart_default_discarderISP_EEEES8_EEEEEOT_RNSt16" \
> "remove_referenceISW_E4typeE"
>
> I don't think there will many symbols with very many entries required.
> I'm guessing that most symbols will require zero (which is why I made
> it defer hashtable creation until it was required).
>
> What kind of data structure would you like to see here, a realloc'd
> array? Do libsupc++ and libstdc++ use the demangler for anything more
> performance-sensitive than exception printing?
I don't know, I guess it isn't very performance sensitive, especially
if it is very rare to need too many of the scopes (at least on real-world
symbols, of course somebody can try to demangle something artificially
hacked up).
Jakub