Change regcache list to be an hash map
The regcache objects created for threads are stored in a linked list,
regcache::current_regcache.
This may result in bad performance when debugging a lot of threads, as GDB
needs to walk the linked list to fetch a regcache given a ptid.
This patch replaces the linked list with an std::unordered_map, indexed by
(ptid, arch). The lookups, in get_thread_arch_aspace_regcache, should become
faster when the number of threads grow. With a small number of threads, it
will probably be a bit slower to do an hash map lookup than to walk a few
linked list nodes, but it should not be perceptible.
The function registers_changed_ptid deletes all regcaches related to a given
ptid (there could be multiple, with different arches). Since the hash map is
indexed by (ptid, arch), we can't do a simple lookup, so we fall back on
iterating on all the hash map values. It should be the same complexity as what
we have today. This function is called when resuming execution, so it would be
nice to find a more efficient way to do this.
Similarly, the function regcache_thread_ptid_changed is called when a thread
changes ptid, so it needs to look up all regcaches for a given ptid. This one
also iterates on all the hash map values. However, it is not called often
(mostly when creating an inferior, on some specific platforms), so it shouldn't
be a problem.
This page took 0.026041 seconds and 4 git commands to generate.