From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1879) id DDF503858D38; Wed, 1 Feb 2023 03:08:46 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org DDF503858D38 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675220926; bh=Sy1U94VQ4sMIe5liRJTfLSHkWzRrwSV+Hdc2CsjCsv4=; h=From:To:Subject:Date:From; b=Yx0TIyC43LUVrhQse4aAvtPifkVXD69HFcAwg1FCTqaYqdgrZsllAJIRIZ3r77HaB L7GpDqY/cP0nCOX+n0KGaenDpk54/hCMRbCzxUuzyLxbCPyd2BTsjW5mq70b79hCd4 1mJWJ3PsxKjANidFQ/KJXwcciwUlqmEizB3ytD7o= Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Simon Marchi To: gdb-cvs@sourceware.org Subject: [binutils-gdb] gdb/dwarf: rename cooked_index to cooked_index_shard X-Act-Checkin: binutils-gdb X-Git-Author: Simon Marchi X-Git-Refname: refs/heads/master X-Git-Oldrev: 6cb7f6d92e4508274fab69c7acbbb961fc45dc70 X-Git-Newrev: a8dc67183978d0b0369ec7e45b19ccd613a2321d Message-Id: <20230201030846.DDF503858D38@sourceware.org> Date: Wed, 1 Feb 2023 03:08:46 +0000 (GMT) List-Id: https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da8dc67183978= d0b0369ec7e45b19ccd613a2321d commit a8dc67183978d0b0369ec7e45b19ccd613a2321d Author: Simon Marchi Date: Tue Jan 31 13:27:20 2023 -0500 gdb/dwarf: rename cooked_index to cooked_index_shard =20 I propose to rename cooked_index_vector and cooked_index such that the "main" object, that is the entry point to the index, is called cooked_index. The fact that the cooked index is implemented as a vector of smaller indexes is an implementation detail. =20 This patch renames cooked_index to cooked_index_shard. The following patch renames cooked_index_vector to cooked_index. =20 Change-Id: Id650f97dcb23c48f8409fa0974cd093ca0b75177 Approved-By: Tom Tromey Diff: --- gdb/dwarf2/cooked-index.c | 22 +++++++++++----------- gdb/dwarf2/cooked-index.h | 12 ++++++------ gdb/dwarf2/read.c | 14 +++++++------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/gdb/dwarf2/cooked-index.c b/gdb/dwarf2/cooked-index.c index 82dc44dd74b..61f825ba629 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -204,10 +204,10 @@ cooked_index_entry::write_scope (struct obstack *stor= age, /* See cooked-index.h. */ =20 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 =3D create (die_offset, tag, flags, name, parent_entry, per_cu); @@ -228,7 +228,7 @@ cooked_index::add (sect_offset die_offset, enum dwarf_t= ag tag, /* See cooked-index.h. */ =20 void -cooked_index::finalize () +cooked_index_shard::finalize () { m_future =3D gdb::thread_pool::g_thread_pool->post_task ([this] () { @@ -239,8 +239,8 @@ cooked_index::finalize () /* See cooked-index.h. */ =20 gdb::unique_xmalloc_ptr -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 =3D ada_decode (entry->name, false, false); if (canonical.empty ()) @@ -281,7 +281,7 @@ cooked_index::handle_gnat_encoded_entry (cooked_index_e= ntry *entry, /* See cooked-index.h. */ =20 void -cooked_index::do_finalize () +cooked_index_shard::do_finalize () { auto hash_name_ptr =3D [] (const void *p) { @@ -378,8 +378,8 @@ cooked_index::do_finalize () =20 /* See cooked-index.h. */ =20 -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 (); =20 @@ -441,7 +441,7 @@ cooked_index_vector::get_addrmaps () const cooked_index_vector::range cooked_index_vector::find (const std::string &name, bool completing) const { - std::vector result_range; + std::vector result_range; result_range.reserve (m_vector.size ()); for (auto &entry : m_vector) result_range.push_back (entry->find (name, completing)); diff --git a/gdb/dwarf2/cooked-index.h b/gdb/dwarf2/cooked-index.h index fa7d8840d16..22fb0110ea2 100644 --- a/gdb/dwarf2/cooked-index.h +++ b/gdb/dwarf2/cooked-index.h @@ -232,11 +232,11 @@ class cooked_index_vector; 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 () =3D default; - DISABLE_COPY_AND_ASSIGN (cooked_index); + cooked_index_shard () =3D default; + DISABLE_COPY_AND_ASSIGN (cooked_index_shard); =20 /* Create a new cooked_index_entry and register it with this object. Entries are owned by this object. The new item is returned. */ @@ -353,7 +353,7 @@ public: =20 /* A convenience typedef for the vector that is contained in this object. */ - typedef std::vector> vec_type; + using vec_type =3D std::vector>; =20 explicit cooked_index_vector (vec_type &&vec); DISABLE_COPY_AND_ASSIGN (cooked_index_vector); @@ -378,7 +378,7 @@ public: } =20 /* A range over a vector of subranges. */ - typedef range_chain range; + using range =3D range_chain; =20 /* Look up an entry by name. Returns a range of all matching results. If COMPLETING is true, then a larger range, suitable @@ -388,7 +388,7 @@ public: /* Return a range of all the entries. */ range all_entries () const { - std::vector result_range; + std::vector result_range; result_range.reserve (m_vector.size ()); for (auto &entry : m_vector) result_range.push_back (entry->all_entries ()); diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index 6cee22a3faa..9c7cb1e4dbc 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -6611,7 +6611,7 @@ public: eq_cutu_reader, htab_delete_entry, xcalloc, xfree)), - m_index (new cooked_index) + m_index (new cooked_index_shard) { } =20 @@ -6657,9 +6657,9 @@ public: return m_index->add (die_offset, tag, flags, name, parent_entry, per_c= u); } =20 - /* 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 release () + std::unique_ptr release () { m_index->install_addrmap (&m_addrmap); return std::move (m_index); @@ -6692,8 +6692,8 @@ private: 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 m_index; + /* The index shard that is being constructed. */ + std::unique_ptr m_index; =20 /* A writeable addrmap being constructed by this scanner. */ addrmap_mutable m_addrmap; @@ -7102,7 +7102,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_o= bjfile) cooked_index_storage index_storage; create_all_units (per_objfile); build_type_psymtabs (per_objfile, &index_storage); - std::vector> indexes; + std::vector> indexes; =20 per_bfd->quick_file_names_table =3D create_quick_file_names_table (per_bfd->all_units.size ()); @@ -7128,7 +7128,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_o= bjfile) 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 =3D std::pair, + using result_type =3D std::pair, std::vector>; std::vector results =3D gdb::parallel_for_each (1, per_bfd->all_units.begin (),