[review v2] Create a correctly-sized demangled names hashtable

Christian Biesinger (Code Review) gerrit@gnutoolchain-gerrit.osci.io
Wed Nov 20 05:34:00 GMT 2019


Christian Biesinger has posted comments on this change.

Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/686
......................................................................


Patch Set 2:

(1 comment)

BTW, thoughts on me pushing this even without the threading changes, so that I have fewer patches to keep track of? Shouldn't hurt anything.

| --- gdb/symtab.c
| +++ gdb/symtab.c
| @@ -771,10 +771,17 @@ create_demangled_names_hash (struct objfile_per_bfd_storage *per_bfd)
|       Choosing a much larger table size wastes memory, and saves only about
| -     1% in symbol reading.  */
| +     1% in symbol reading.  However, if the minsym count is already
| +     initialized (e.g. because symbol name setting was deferred to
| +     a background thread) we can initialize the hashtable with that
| +     count, because we will almost certainly have at least that
| +     many entries.  If we have a nonzero number but less than 256,
| +     we still stay with 256 to have some space for psymbols, etc.  */
| +
| +  int count = std::max (per_bfd->minimal_symbol_count, 256);

PS1, Line 779:

Yes, +2 is for rounding. Done and added a comment for that.

|  
|    per_bfd->demangled_names_hash.reset (htab_create_alloc
| -    (256, hash_demangled_name_entry, eq_demangled_name_entry,
| +    (count, hash_demangled_name_entry, eq_demangled_name_entry,
|       free_demangled_name_entry, xcalloc, xfree));
|  }
|  
|  /* See symtab.h  */
|  

-- 
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I1f074d38e1d90af58705ec852f90c84cc034cd2e
Gerrit-Change-Number: 686
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Christian Biesinger <cbiesinger@google.com>
Gerrit-CC: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-Comment-Date: Wed, 20 Nov 2019 05:34:46 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Christian Biesinger <cbiesinger@google.com>
Comment-In-Reply-To: Simon Marchi <simon.marchi@polymtl.ca>
Gerrit-MessageType: comment



More information about the Gdb-patches mailing list