aboutsummaryrefslogtreecommitdiff
path: root/gdb/objfiles.h
diff options
context:
space:
mode:
authorChristian Biesinger <cbiesinger@google.com>2019-10-30 15:10:23 -0500
committerChristian Biesinger <cbiesinger@google.com>2019-11-18 17:51:10 -0600
commit12f4dc41bf9f018ecc1042830d5534de941f329e (patch)
tree550e34221781f792ddf1ed9c45ce5eed56362e13 /gdb/objfiles.h
parent6f509f24899f79095673698b611e81f980806fb5 (diff)
downloadbinutils-users/cbiesinger/all-perf-patches.zip
binutils-users/cbiesinger/all-perf-patches.tar.gz
binutils-users/cbiesinger/all-perf-patches.tar.bz2
[RFC] Don't block on finishing demangling msymbolsusers/cbiesinger/all-perf-patches
Instead, do it all on a background thread and only block when we actually need the result. Note, this is a speedup but not quite as much as I was expecting; still looking into what causes the waits. However, let me know if you have thoughts on the concept! Change-Id: I9d871917459ece0b41d31670b3c56600757aea66
Diffstat (limited to 'gdb/objfiles.h')
-rw-r--r--gdb/objfiles.h18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdb/objfiles.h b/gdb/objfiles.h
index 0c04458..1c126c1 100644
--- a/gdb/objfiles.h
+++ b/gdb/objfiles.h
@@ -30,6 +30,9 @@
#include "psymtab.h"
#include <bitset>
#include <vector>
+#if CXX_STD_THREAD
+#include <future>
+#endif
#include "gdbsupport/next-iterator.h"
#include "gdbsupport/safe-iterator.h"
#include "bcache.h"
@@ -319,6 +322,19 @@ struct objfile_per_bfd_storage
/* All the different languages of symbols found in the demangled
hash table. */
std::bitset<nr_languages> demangled_hash_languages;
+
+ void wait_for_msymbols() {
+#if CXX_STD_THREAD
+ if (m_minsym_future.valid ())
+ {
+ m_minsym_future.wait ();
+ m_minsym_future = std::future<void> ();
+ }
+#endif
+ }
+#if CXX_STD_THREAD
+ std::future<void> m_minsym_future;
+#endif
};
/* An iterator that first returns a parent objfile, and then each
@@ -439,11 +455,13 @@ struct objfile
minimal_symbol_iterator begin () const
{
+ m_objfile->per_bfd->wait_for_msymbols ();
return minimal_symbol_iterator (m_objfile->per_bfd->msymbols.get ());
}
minimal_symbol_iterator end () const
{
+ m_objfile->per_bfd->wait_for_msymbols ();
return minimal_symbol_iterator
(m_objfile->per_bfd->msymbols.get ()
+ m_objfile->per_bfd->minimal_symbol_count);