This is the mail archive of the elfutils-devel@sourceware.org mailing list for the elfutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: dwarf_output overview


On Wed, 2011-01-05 at 09:35 -0800, Roland McGrath wrote:
> The only places where we use that pointer as an integer hash are when
> it's being combined as part of a larger object's hash.  That is done in
> computing the hash of a debug_info_entry::children_type and the hash of
> a value::value_reference.
>
> This is why _m_attributes and _m_children are pointers rather than
> direct containers in the debug_info_entry.  Each of those has its own
> hash function and its own hash table in the collector (_m_attr_sets,
> _m_broods).  The children_type stores its own hash once computed, so
> "taking the hash of *_m_children" above is really just extracting
> _m_children->_m_hash.  Likewise for attributes_types.  So that hash
> function above is just the two steps of hash_combine arithmetic.
> 
> Is that more clear now?

Aha. Yes, that was what I was missing.
Depending on context there are different hashes used.

If we already have a hash function for an object, it might make sense to
just reuse that (if only for people like me, who get easily confused
otherwise). Pointers might actually have less useful bits since they
could be clustered together or are aligned on certain addresses, making
some of the bits all equal.

Cheers,

Mark


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]