From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 8145 invoked by alias); 28 Mar 2011 12:59:22 -0000 Received: (qmail 8136 invoked by uid 22791); 28 Mar 2011 12:59:21 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,TW_BJ,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Mon, 28 Mar 2011 12:59:13 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id p2SCxDsm028232 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Mon, 28 Mar 2011 08:59:13 -0400 Received: from host1.jankratochvil.net (ovpn01.gateway.prod.ext.phx2.redhat.com [10.5.9.1]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id p2SCxB2K019359 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Mon, 28 Mar 2011 08:59:12 -0400 Received: from host1.jankratochvil.net (localhost [127.0.0.1]) by host1.jankratochvil.net (8.14.4/8.14.4) with ESMTP id p2SCxAtw020793; Mon, 28 Mar 2011 14:59:10 +0200 Received: (from jkratoch@localhost) by host1.jankratochvil.net (8.14.4/8.14.4/Submit) id p2SCxAut020792; Mon, 28 Mar 2011 14:59:10 +0200 Date: Mon, 28 Mar 2011 14:22:00 -0000 From: Jan Kratochvil To: Tom Tromey Cc: gdb-patches@sourceware.org Subject: Re: [patch 5/7] STT_GNU_IFUNC symbols reader Message-ID: <20110328125910.GA20141@host1.jankratochvil.net> References: <20110319211628.GF30867@host1.jankratochvil.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org X-SW-Source: 2011-03/txt/msg01126.txt.bz2 On Mon, 21 Mar 2011 21:45:29 +0100, Tom Tromey wrote: > >>>>> "Jan" == Jan Kratochvil 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