[RFC] Use custom hash function with bcache
Doug Evans
dje@google.com
Mon Aug 16 18:56:00 GMT 2010
On Mon, Aug 16, 2010 at 11:28 AM, Doug Evans <dje@google.com> wrote:
> On Mon, Aug 16, 2010 at 7:10 AM, sami wagiaalla <swagiaal@redhat.com> wrote:
>> This patch enables the use of custom hash and comparison functions when
>> adding elements to a bcache. The patch also introduces hash and comparison
>> functions which take into consideration only the relevant properties of the
>> psymbol.
>>
>> Tested by running the test suit on F13 with gcc 4.4.4 on x8664, no
>> regressions.
>>
>> also used 'main print statistics' to ensure that the bcache object count and
>> unique object count are as expected with a small test case.
>>
>> Sami
>>
>
> Hi. Comments inline with the patch.
>
>
> 2010-08-13 Sami Wagiaalla <swagiaal@redhat.com>
>
> * psymtab.c (psymbol_hash): New function.
> (psymbol_compare): New function.
> (add_psymbol_to_bcache): pass psymbol_hash and psymbol_compare
> to bcache_full.
> * bcache.c (hash_continue): New.
> (hash): Use hash_continue.
> (bcache): Now takes hash_function, compare_function arguments.
> (bcache_full): Ditto.
> * bcache.c (bcache): Update prototype.
> (bcache_full): Ditto.
> * macrotab.c (macro_bcache): Updated.
> * symfile.c (allocate_symtab): Updated.
Blech, I forgot to add that we can get rid of the static in "static
struct partial_symbol psymbol;" in add_psymbol_to_bcache.
I think that should be part of this patch.
A couple more things come to mind.
1) We store symbol names such that we can compare them with ptr1 ==
ptr2, but your patch uses strcmp.
2) I'm wondering if there's some abstraction violation with bcache not
being aware of the extra memory that is used by
gsymbol->language_specific.cplus_specific. Dunno, just wondering.
More information about the Gdb-patches
mailing list