diff options
author | Frank Ch. Eigler <fche@elastic.org> | 2008-07-11 16:50:18 -0400 |
---|---|---|
committer | Frank Ch. Eigler <fche@elastic.org> | 2008-07-11 16:50:18 -0400 |
commit | 7bb73781111a053767a520ed45f1caeb8b9c9dd1 (patch) | |
tree | 3a60b8d31f0ba38b0dbad99ffe953d8f08834df8 | |
parent | 3e493754868ecd954281bfffe8b59adb0f461c95 (diff) | |
download | systemtap-steved-7bb73781111a053767a520ed45f1caeb8b9c9dd1.tar.gz systemtap-steved-7bb73781111a053767a520ed45f1caeb8b9c9dd1.tar.xz systemtap-steved-7bb73781111a053767a520ed45f1caeb8b9c9dd1.zip |
PR6739: speed up decl-alias cache by avoiding its recomputation; move to per-module/cu
-rw-r--r-- | ChangeLog | 9 | ||||
-rw-r--r-- | tapsets.cxx | 45 |
2 files changed, 35 insertions, 19 deletions
@@ -1,5 +1,14 @@ 2008-07-11 Frank Ch. Eigler <fche@elastic.org> + PR 6739 + * tapsets.cxx (global_alias_cache): Make this a per-module/cu cache, + just like the function cache. + (update_alias_cache): Removed. Instead ... + (declaration_resolve): Compute the lookup table for this module/cu, + but only once. + +2008-07-11 Frank Ch. Eigler <fche@elastic.org> + * translate.cxx (dump_unwindsyms): Start tolerating user-space programs, which may be unrelocatable. diff --git a/tapsets.cxx b/tapsets.cxx index c15eb5ca..21c9fb54 100644 --- a/tapsets.cxx +++ b/tapsets.cxx @@ -1158,7 +1158,7 @@ struct dwflpp // ----------------------------------------------------------------- - /* The global alias cache is used to resolve any DIE found in a + /* The global alias cache is used to resolve any DIE found in a * module that is stubbed out with DW_AT_declaration with a defining * DIE found in a different module. The current assumption is that * this only applies to structures and unions, which have a global @@ -1166,11 +1166,10 @@ struct dwflpp * cache is indexed by name. If other declaration lookups were * added to it, it would have to be indexed by name and tag */ - cu_function_cache_t global_alias_cache; - + mod_cu_function_cache_t global_alias_cache; static int global_alias_caching_callback(Dwarf_Die *die, void *arg) { - dwflpp *dw = static_cast<struct dwflpp *>(arg); + cu_function_cache_t *cache = static_cast<cu_function_cache_t*>(arg); const char *name = dwarf_diename(die); if (!name) @@ -1179,9 +1178,8 @@ struct dwflpp string structure_name = name; if (!dwarf_hasattr(die, DW_AT_declaration) && - dw->global_alias_cache.find(structure_name) == - dw->global_alias_cache.end()) - dw->global_alias_cache[structure_name] = *die; + cache->find(structure_name) == cache->end()) + (*cache)[structure_name] = *die; return DWARF_CB_OK; } @@ -1193,10 +1191,29 @@ struct dwflpp if (!name) return NULL; - if (global_alias_cache.find(name) == global_alias_cache.end()) + string key = module_name + ":" + cu_name; + cu_function_cache_t *v = global_alias_cache[key]; + if (v == 0) // need to build the cache, just once per encountered module/cu + { + v = new cu_function_cache_t; + global_alias_cache[key] = v; + iterate_over_globals(global_alias_caching_callback, v); + if (sess.verbose > 4) + clog << "global alias cache " << key << " size " << v->size() << endl; + } + + // XXX: it may be desirable to search other modules' declarations + // too, in case a module/shared-library processes a + // forward-declared pointer type only, where the actual definition + // may only be in vmlinux or the application. + + // XXX: it is probably desirable to search other CU's declarations + // in the same module. + + if (v->find(name) == v->end()) return NULL; - return &global_alias_cache[name]; + return & ((*v)[name]); } mod_cu_function_cache_t cu_function_cache; @@ -1214,14 +1231,6 @@ struct dwflpp int iterate_over_globals (int (* callback)(Dwarf_Die *, void *), void * data); - int update_alias_cache(void) - { - int rc; - - rc = iterate_over_globals(global_alias_caching_callback, this); - return rc; - } - bool has_single_line_record (dwarf_query * q, char const * srcfile, int lineno); void iterate_over_srcfile_lines (char const * srcfile, @@ -3596,8 +3605,6 @@ query_cu (Dwarf_Die * cudie, void * arg) { q->dw.focus_on_cu (cudie); - q->dw.update_alias_cache(); - if (false && q->sess.verbose>2) clog << "focused on CU '" << q->dw.cu_name << "', in module '" << q->dw.module_name << "'\n"; |