From 64deb08509bf9682e7d3b8141399c5603edb2df2 Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Wed, 2 Sep 2009 16:43:58 -0700 Subject: Provide backward-compatible unordered_map/set We were defining our own stap_map with a ::type to let us use typedefs to use the new unordered_map if available, or hash_map otherwise. Since unordered_map is the future direction, I'm changing our code to use that directly. The backward-compatible version is a #define to hash_map, which has a compatible interface. While I'm at it, let's also define unordered_multimap, unordered_set, and unordered_multiset. * unordered.h: New. * dwflpp.h (stap_map): Removed. (cache typedefs): Use the unordered name now. --- dwflpp.h | 25 +++++-------------------- 1 file changed, 5 insertions(+), 20 deletions(-) (limited to 'dwflpp.h') diff --git a/dwflpp.h b/dwflpp.h index 047ad602..9ed18558 100644 --- a/dwflpp.h +++ b/dwflpp.h @@ -15,6 +15,7 @@ #include "dwarf_wrappers.h" #include "elaborate.h" #include "session.h" +#include "unordered.h" #include #include @@ -43,33 +44,17 @@ struct dwarf_query; enum line_t { ABSOLUTE, RELATIVE, RANGE, WILDCARD }; enum info_status { info_unknown, info_present, info_absent }; -#ifdef HAVE_TR1_UNORDERED_MAP -#include -template struct stap_map { - typedef std::tr1::unordered_map type; -}; -#else -#include -template struct stap_map { - typedef __gnu_cxx::hash_map type; - size_t operator() (std::string const& s) const - { __gnu_cxx::hash h; return h(s.c_str()); } - size_t operator() (void* const& p) const - { __gnu_cxx::hash h; return h(reinterpret_cast(p)); } -}; -#endif - // module -> cu die[] -typedef stap_map*>::type module_cu_cache_t; +typedef unordered_map*> module_cu_cache_t; // function -> die -typedef stap_map::type cu_function_cache_t; +typedef unordered_map cu_function_cache_t; // cu die -> (function -> die) -typedef stap_map::type mod_cu_function_cache_t; +typedef unordered_map mod_cu_function_cache_t; // inline function die -> instance die[] -typedef stap_map*>::type cu_inl_function_cache_t; +typedef unordered_map*> cu_inl_function_cache_t; typedef std::vector func_info_map_t; typedef std::vector inline_instance_map_t; -- cgit