summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoland McGrath <[email protected]>2009-11-01 20:50:27 -0800
committerRoland McGrath <[email protected]>2009-11-01 20:50:27 -0800
commitbd1ad899a737a149e75a7947235cf7d73a458f24 (patch)
tree9247ab34f4ec477352c68fc48cf475bb76d78702
parent4ce456a9263a7754a7253f198ef491b7f6b42043 (diff)
Include tag in attr_set hash, cuts down collisions.
-rw-r--r--libdw/c++/dwarf_output27
1 files changed, 15 insertions, 12 deletions
diff --git a/libdw/c++/dwarf_output b/libdw/c++/dwarf_output
index 8928d40d..3110ea30 100644
--- a/libdw/c++/dwarf_output
+++ b/libdw/c++/dwarf_output
@@ -953,13 +953,14 @@ namespace elfutils
}
// Set of attribute maps.
- subr::dynamic_equality_set<attrs_type> _m_attr_sets;
+ typedef std::pair<attrs_type, int> attrs_pair;
+ subr::dynamic_equality_set<attrs_pair> _m_attr_sets;
template<typename match_type>
- inline const attrs_type *
- add_attributes (const attrs_type &candidate, match_type &matcher)
+ inline const attrs_pair *
+ add_attributes (int tag, const attrs_type &candidate, match_type &matcher)
{
- return _m_attr_sets.add (candidate, matcher);
+ return _m_attr_sets.add (std::make_pair (candidate, tag), matcher);
}
// Set of children lists.
@@ -1082,7 +1083,7 @@ namespace elfutils
inline void
operator () (size_t hash,
- const subr::dynamic_equality_set<attrs_type>::bucket_type &b)
+ const subr::dynamic_equality_set<attrs_pair>::bucket_type &b)
const
{
_m_out << "attrs bucket " << std::hex << hash
@@ -1090,10 +1091,11 @@ namespace elfutils
subr::for_each (b, *this);
}
- inline void operator () (const attrs_type &attrs) const
+ inline void operator () (const attrs_pair &attrs) const
{
- _m_out << "\t" << attrs.size ();
- subr::for_each (attrs, *this);
+ _m_out << "\t" << dwarf::tags::name (attrs.second)
+ << " " << attrs.first.size ();
+ subr::for_each (attrs.first, *this);
_m_out << "\n";
}
@@ -1355,15 +1357,16 @@ namespace elfutils
return _m_self;
}
+ typedef std::pair <debug_info_entry::attributes_type, int> attrs_pair;
struct attrs_matcher
{
copier *_m_copier;
inline explicit attrs_matcher (copier *c) : _m_copier (c) {}
- inline bool operator () (const debug_info_entry::attributes_type &a,
- const debug_info_entry::attributes_type &b)
+ inline bool operator () (const attrs_pair &a, const attrs_pair &b)
{
- return _m_copier->attrs_match (a, b);
+ return (a.second == b.second
+ && _m_copier->attrs_match (a.first, b.first));
}
};
@@ -1394,7 +1397,7 @@ namespace elfutils
{
attrs_matcher equalator (c);
const debug_info_entry::attributes_type *attrs
- = co->add_attributes (_m_attributes, equalator);
+ = &co->add_attributes (_m_tag, _m_attributes, equalator)->first;
const debug_info_entry::children_type *children
= co->add_children (get_final_children ()