/* See cooked-index.h. */
const cooked_index_entry *
-cooked_index::add (sect_offset die_offset, enum dwarf_tag tag,
- cooked_index_flag flags, const char *name,
- const cooked_index_entry *parent_entry,
- dwarf2_per_cu_data *per_cu)
+cooked_index_shard::add (sect_offset die_offset, enum dwarf_tag tag,
+ cooked_index_flag flags, const char *name,
+ const cooked_index_entry *parent_entry,
+ dwarf2_per_cu_data *per_cu)
{
cooked_index_entry *result = create (die_offset, tag, flags, name,
parent_entry, per_cu);
/* See cooked-index.h. */
void
-cooked_index::finalize ()
+cooked_index_shard::finalize ()
{
m_future = gdb::thread_pool::g_thread_pool->post_task ([this] ()
{
/* See cooked-index.h. */
gdb::unique_xmalloc_ptr<char>
-cooked_index::handle_gnat_encoded_entry (cooked_index_entry *entry,
- htab_t gnat_entries)
+cooked_index_shard::handle_gnat_encoded_entry (cooked_index_entry *entry,
+ htab_t gnat_entries)
{
std::string canonical = ada_decode (entry->name, false, false);
if (canonical.empty ())
/* See cooked-index.h. */
void
-cooked_index::do_finalize ()
+cooked_index_shard::do_finalize ()
{
auto hash_name_ptr = [] (const void *p)
{
/* See cooked-index.h. */
-cooked_index::range
-cooked_index::find (const std::string &name, bool completing) const
+cooked_index_shard::range
+cooked_index_shard::find (const std::string &name, bool completing) const
{
wait ();
cooked_index_vector::range
cooked_index_vector::find (const std::string &name, bool completing) const
{
- std::vector<cooked_index::range> result_range;
+ std::vector<cooked_index_shard::range> result_range;
result_range.reserve (m_vector.size ());
for (auto &entry : m_vector)
result_range.push_back (entry->find (name, completing));
Operations on the index are described below. They are chosen to
make it relatively simple to implement the symtab "quick"
methods. */
-class cooked_index
+class cooked_index_shard
{
public:
- cooked_index () = default;
- DISABLE_COPY_AND_ASSIGN (cooked_index);
+ cooked_index_shard () = default;
+ DISABLE_COPY_AND_ASSIGN (cooked_index_shard);
/* Create a new cooked_index_entry and register it with this object.
Entries are owned by this object. The new item is returned. */
/* A convenience typedef for the vector that is contained in this
object. */
- typedef std::vector<std::unique_ptr<cooked_index>> vec_type;
+ using vec_type = std::vector<std::unique_ptr<cooked_index_shard>>;
explicit cooked_index_vector (vec_type &&vec);
DISABLE_COPY_AND_ASSIGN (cooked_index_vector);
}
/* A range over a vector of subranges. */
- typedef range_chain<cooked_index::range> range;
+ using range = range_chain<cooked_index_shard::range>;
/* Look up an entry by name. Returns a range of all matching
results. If COMPLETING is true, then a larger range, suitable
/* Return a range of all the entries. */
range all_entries () const
{
- std::vector<cooked_index::range> result_range;
+ std::vector<cooked_index_shard::range> result_range;
result_range.reserve (m_vector.size ());
for (auto &entry : m_vector)
result_range.push_back (entry->all_entries ());
eq_cutu_reader,
htab_delete_entry<cutu_reader>,
xcalloc, xfree)),
- m_index (new cooked_index)
+ m_index (new cooked_index_shard)
{
}
return m_index->add (die_offset, tag, flags, name, parent_entry, per_cu);
}
- /* Install the current addrmap into the index being constructed,
+ /* Install the current addrmap into the index shard being constructed,
then transfer ownership of the index to the caller. */
- std::unique_ptr<cooked_index> release ()
+ std::unique_ptr<cooked_index_shard> release ()
{
m_index->install_addrmap (&m_addrmap);
return std::move (m_index);
abbrev_cache m_abbrev_cache;
/* A hash table of cutu_reader objects. */
htab_up m_reader_hash;
- /* The index that is being constructed. */
- std::unique_ptr<cooked_index> m_index;
+ /* The index shard that is being constructed. */
+ std::unique_ptr<cooked_index_shard> m_index;
/* A writeable addrmap being constructed by this scanner. */
addrmap_mutable m_addrmap;
cooked_index_storage index_storage;
create_all_units (per_objfile);
build_type_psymtabs (per_objfile, &index_storage);
- std::vector<std::unique_ptr<cooked_index>> indexes;
+ std::vector<std::unique_ptr<cooked_index_shard>> indexes;
per_bfd->quick_file_names_table
= create_quick_file_names_table (per_bfd->all_units.size ());
GDB's I/O system is not thread-safe. run_on_main_thread could be
used, but that would mean the messages are printed after the
prompt, which looks weird. */
- using result_type = std::pair<std::unique_ptr<cooked_index>,
+ using result_type = std::pair<std::unique_ptr<cooked_index_shard>,
std::vector<gdb_exception>>;
std::vector<result_type> results
= gdb::parallel_for_each (1, per_bfd->all_units.begin (),