Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Jan Kratochvil <jan.kratochvil@redhat.com>
To: Tom Tromey <tromey@redhat.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [patch 5/7] STT_GNU_IFUNC symbols reader
Date: Mon, 28 Mar 2011 14:22:00 -0000	[thread overview]
Message-ID: <20110328125910.GA20141@host1.jankratochvil.net> (raw)
In-Reply-To: <m3oc54td7a.fsf@fleche.redhat.com>

On Mon, 21 Mar 2011 21:45:29 +0100, Tom Tromey wrote:
> >>>>> "Jan" == Jan Kratochvil <jan.kratochvil@redhat.com> writes:
> Jan> +      htab = htab_create_alloc_ex (1, elf_gnu_ifunc_cache_hash,
> Jan> +				   elf_gnu_ifunc_cache_eq,
> Jan> +				   NULL, &objfile->objfile_obstack,
> Jan> +				   hashtab_obstack_allocate,
> Jan> +				   dummy_obstack_deallocate);
> 
> It seems just as easy to allocate the hash table so that rehashing
> doesn't waste memory.

To clarify the comment:

This statement is in elf_gnu_ifunc_record_cache, HTAB is used only for the
cache of STT_GNU_IFUNC resolved addresses where GDB explicitly had to figure
out the address due to a user request for breakpoint on that function.

That is usually only few of the functions will ever get stored by
elf_gnu_ifunc_record_cache into that hash even if the objfile has many
STT_GNU_IFUNC symbols.

Did you mean that GDB should make the hash size its maximum possible one, by
counting the STT_GNU_IFUNC symbols in that objfile?  I understand even an
occasional rehashing is more expensive than a larger than needed initial
allocation each time.

BTW the rehashing using non-deallocating hashtab_obstack_allocate already
commonly happens in current FSF GDB code.

While I do not want to oppose your constructive comment still I have to note
the value 1 may be IMO the optimal one during most of the GDB use cases. :-)


Thanks,
Jan


  reply	other threads:[~2011-03-28 12:59 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-19 21:17 Jan Kratochvil
2011-03-21 21:15 ` Tom Tromey
2011-03-28 14:22   ` Jan Kratochvil [this message]
2011-03-28 19:52     ` Tom Tromey
2011-03-28 20:32       ` [commit] " Jan Kratochvil

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=20110328125910.GA20141@host1.jankratochvil.net \
    --to=jan.kratochvil@redhat.com \
    --cc=gdb-patches@sourceware.org \
    --cc=tromey@redhat.com \
    /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