From d089f5b2932a473692f8c3e1badb883fabc55dee Mon Sep 17 00:00:00 2001 From: Josh Stone Date: Tue, 25 Aug 2009 17:23:28 -0700 Subject: Index cu_inl_function_cache_t by function->addr Again, avoid needless string construction for map indexing. * dwflpp.h (cu_inl_function_cache_t): Index by the void* function->addr. * dwflpp.cxx (dwflpp::iterate_over_inline_instances): Index cu_inl_function_cache by function->addr. --- dwflpp.cxx | 5 ++--- dwflpp.h | 4 +++- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/dwflpp.cxx b/dwflpp.cxx index f0bf7dcf..7d4fa3ab 100644 --- a/dwflpp.cxx +++ b/dwflpp.cxx @@ -514,12 +514,11 @@ dwflpp::iterate_over_inline_instances (int (* callback)(Dwarf_Die * die, void * assert (function); assert (func_is_inline ()); - string key = module_name + ":" + cu_name + ":" + function_name; - vector* v = cu_inl_function_cache[key]; + vector* v = cu_inl_function_cache[function->addr]; if (v == 0) { v = new vector; - cu_inl_function_cache[key] = v; + cu_inl_function_cache[function->addr] = v; dwarf_func_inline_instances (function, cu_inl_function_caching_callback, v); } diff --git a/dwflpp.h b/dwflpp.h index 1d6fe0c8..9c342090 100644 --- a/dwflpp.h +++ b/dwflpp.h @@ -65,6 +65,9 @@ typedef stap_map::type cu_function_cache_t; // cu die -> (function -> die) typedef stap_map::type mod_cu_function_cache_t; +// inline function die -> instance die[] +typedef stap_map*>::type cu_inl_function_cache_t; + typedef std::vector func_info_map_t; typedef std::vector inline_instance_map_t; @@ -289,7 +292,6 @@ private: typedef std::map*> module_cu_cache_t; module_cu_cache_t module_cu_cache; - typedef std::map*> cu_inl_function_cache_t; cu_inl_function_cache_t cu_inl_function_cache; static int cu_inl_function_caching_callback (Dwarf_Die* func, void *arg); -- cgit