From: "Christian Biesinger (Code Review)" <gerrit@gnutoolchain-gerrit.osci.io>
To: Christian Biesinger <cbiesinger@google.com>, gdb-patches@sourceware.org
Cc: Tom Tromey <tromey@sourceware.org>
Subject: [review v2] Precompute hash value for symbol_set_names
Date: Tue, 29 Oct 2019 21:56:00 -0000 [thread overview]
Message-ID: <20191029215601.31C5A2A7D9@gnutoolchain-gerrit.osci.io> (raw)
In-Reply-To: <gerrit.1572031795000.I044449e7eb60cffc1c43efd3412f2b485bd9faac@gnutoolchain-gerrit.osci.io>
Christian Biesinger has posted comments on this change.
Change URL: https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/307
......................................................................
Uploaded patch set 2.
(4 comments)
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/307/1/gdb/minsyms.c
File gdb/minsyms.c:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/307/1/gdb/minsyms.c@1252
PS1, Line 1252:
1243 | else
1244 | *copyto++ = *copyfrom++;
1245 | }
1246 | *copyto++ = *copyfrom++;
1247 | mcount = copyto - msymbol;
1248 | }
1249 | return (mcount);
1250 | }
1251 |
1252 | struct computed_hash_values {
> { on next line.
Done
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/307/1/gdb/minsyms.c@1392
PS1, Line 1392:
1370 | #endif
| ...
1383 | /* This will be freed later, by symbol_set_names. */
1384 | char *demangled_name
1385 | = symbol_find_demangled_name (msym, msym->name);
1386 | symbol_set_demangled_name
1387 | (msym, demangled_name,
1388 | &m_objfile->per_bfd->storage_obstack);
1389 | msym->name_set = 1;
1390 |
1391 | size_t idx = msym - msymbols;
1392 | hash_values[idx].mangled_name_hash = htab_hash_string (msym->name);
> over-long line? Also, fast_hash
Great catch, thanks!
Since I now need strlen (msym->name) in two places, I decided to store that in hash_values[idx] as well. Let me know if you dislike that.
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/307/1/gdb/symtab.h
File gdb/symtab.h:
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/307/1/gdb/symtab.h@518
PS1, Line 518:
509 | it. Used for constructs which do not have a mangled name,
510 | e.g. struct tags. Unlike SYMBOL_SET_NAMES, linkage_name must
511 | be terminated and either already on the objfile's obstack or
512 | permanently allocated. */
513 | #define SYMBOL_SET_LINKAGE_NAME(symbol,linkage_name) \
514 | (symbol)->ginfo.name = (linkage_name)
515 |
516 | /* Set the linkage and natural names of a symbol, by demangling
517 | the linkage name. Optionally, HASH can be set to the value
518 | of htab_hash_string (linkage_name) (if nullterminated), to
> This has to refer to `fast_hash` now.
Done
https://gnutoolchain-gerrit.osci.io/r/c/binutils-gdb/+/307/1/gdb/symtab.h@526
PS1, Line 526:
517 | the linkage name. Optionally, HASH can be set to the value
518 | of htab_hash_string (linkage_name) (if nullterminated), to
519 | speed up this function. */
520 | #define SYMBOL_SET_NAMES(symbol,linkage_name,len,copy_name,objfile) \
521 | symbol_set_names (&(symbol)->ginfo, linkage_name, len, copy_name, \
522 | (objfile)->per_bfd)
523 | extern void symbol_set_names (struct general_symbol_info *symbol,
524 | const char *linkage_name, int len, bool copy_name,
525 | struct objfile_per_bfd_storage *per_bfd,
526 | hashval_t hash = 0);
> I suppose an optional<hashval_t> would avoid the problem [â¦]
Done
--
Gerrit-Project: binutils-gdb
Gerrit-Branch: master
Gerrit-Change-Id: I044449e7eb60cffc1c43efd3412f2b485bd9faac
Gerrit-Change-Number: 307
Gerrit-PatchSet: 2
Gerrit-Owner: Christian Biesinger <cbiesinger@google.com>
Gerrit-Reviewer: Tom Tromey <tromey@sourceware.org>
Gerrit-Comment-Date: Tue, 29 Oct 2019 21:56:00 +0000
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Comment-In-Reply-To: Tom Tromey <tromey@sourceware.org>
Gerrit-MessageType: comment
next prev parent reply other threads:[~2019-10-29 21:56 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-25 19:30 [review] " Christian Biesinger (Code Review)
2019-10-29 19:28 ` Tom Tromey (Code Review)
2019-10-29 21:56 ` [review v2] " Christian Biesinger (Code Review)
2019-10-29 21:56 ` Christian Biesinger (Code Review) [this message]
2019-10-31 0:23 ` [review v3] " Christian Biesinger (Code Review)
2019-11-26 22:08 ` [review v4] " Tom Tromey (Code Review)
2019-11-26 22:23 ` [review v5] " Christian Biesinger (Code Review)
2019-11-26 22:24 ` Christian Biesinger (Code Review)
2019-11-27 18:03 ` Tom Tromey (Code Review)
2019-11-27 21:40 ` [pushed] " Sourceware to Gerrit sync (Code Review)
2019-11-27 21:40 ` Sourceware to Gerrit sync (Code Review)
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=20191029215601.31C5A2A7D9@gnutoolchain-gerrit.osci.io \
--to=gerrit@gnutoolchain-gerrit.osci.io \
--cc=cbiesinger@google.com \
--cc=gdb-patches@sourceware.org \
--cc=gnutoolchain-gerrit@osci.io \
--cc=tromey@sourceware.org \
/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).