From patchwork Tue Jan 31 18:27:20 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 64042 Return-Path: X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 912A43858421 for ; Tue, 31 Jan 2023 18:27:51 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 912A43858421 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675189671; bh=0pbWVYXfCWdV2QUe8qWsHn/rSWxT21P2LD2jVTLsd2s=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=ZVoqbPHlNjAWcJ10GAaHhWvfmnqfEpFrFGEQ/aZ5DT1NrleKiNOtmYoCjXfSAYaEj PEtkgZmCow2NjPM40av3Ei2Ue10PSPsNMU0iAhP6LH4xir8LTr6JqiSUmd58onaBvA 0pVQmqBI/edl2Ykc/u9PBqGtov4QV5pMglLdKgDE= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from barracuda.ebox.ca (barracuda.ebox.ca [96.127.255.19]) by sourceware.org (Postfix) with ESMTPS id EA8403858D28 for ; Tue, 31 Jan 2023 18:27:23 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org EA8403858D28 X-ASG-Debug-ID: 1675189642-0c856e762a884860001-fS2M51 Received: from smtp.ebox.ca (smtp.ebox.ca [96.127.255.82]) by barracuda.ebox.ca with ESMTP id N6EK4qLcQZVVtXET (version=TLSv1 cipher=AES128-SHA bits=128 verify=NO); Tue, 31 Jan 2023 13:27:22 -0500 (EST) X-Barracuda-Envelope-From: simon.marchi@efficios.com X-Barracuda-RBL-Trusted-Forwarder: 96.127.255.82 Received: from smarchi-efficios.internal.efficios.com (192-222-180-24.qc.cable.ebox.net [192.222.180.24]) by smtp.ebox.ca (Postfix) with ESMTP id 0F659441B21; Tue, 31 Jan 2023 13:27:22 -0500 (EST) X-Barracuda-RBL-IP: 192.222.180.24 X-Barracuda-Effective-Source-IP: 192-222-180-24.qc.cable.ebox.net[192.222.180.24] X-Barracuda-Apparent-Source-IP: 192.222.180.24 To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH 1/2] gdb/dwarf: rename cooked_index to cooked_index_shard Date: Tue, 31 Jan 2023 13:27:20 -0500 X-ASG-Orig-Subj: [PATCH 1/2] gdb/dwarf: rename cooked_index to cooked_index_shard Message-Id: <20230131182721.71119-1-simon.marchi@efficios.com> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-Barracuda-Connect: smtp.ebox.ca[96.127.255.82] X-Barracuda-Start-Time: 1675189642 X-Barracuda-Encrypted: AES128-SHA X-Barracuda-URL: https://96.127.255.19:443/cgi-mod/mark.cgi X-Barracuda-BRTS-Status: 1 X-Virus-Scanned: by bsmtpd at ebox.ca X-Barracuda-Scan-Msg-Size: 7438 X-Barracuda-Spam-Score: 0.00 X-Barracuda-Spam-Status: No, SCORE=0.00 using global scores of TAG_LEVEL=1000.0 QUARANTINE_LEVEL=1000.0 KILL_LEVEL=5.0 tests= X-Barracuda-Spam-Report: Code version 3.2, rules version 3.2.3.104137 Rule breakdown below pts rule name description ---- ---------------------- -------------------------------------------------- X-Spam-Status: No, score=-3498.1 required=5.0 tests=BAYES_00, GIT_PATCH_0, KAM_DMARC_NONE, KAM_DMARC_STATUS, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_SOFTFAIL, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Simon Marchi via Gdb-patches From: Simon Marchi Reply-To: Simon Marchi Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" 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. This patch renames cooked_index to cooked_index_shard. The following patch renames cooked_index_vector to cooked_index. Change-Id: Id650f97dcb23c48f8409fa0974cd093ca0b75177 --- 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 82dc44dd74b0..61f825ba6299 100644 --- a/gdb/dwarf2/cooked-index.c +++ b/gdb/dwarf2/cooked-index.c @@ -204,10 +204,10 @@ cooked_index_entry::write_scope (struct obstack *storage, /* 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); @@ -228,7 +228,7 @@ cooked_index::add (sect_offset die_offset, enum dwarf_tag tag, /* See cooked-index.h. */ void -cooked_index::finalize () +cooked_index_shard::finalize () { m_future = gdb::thread_pool::g_thread_pool->post_task ([this] () { @@ -239,8 +239,8 @@ cooked_index::finalize () /* See cooked-index.h. */ 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 = ada_decode (entry->name, false, false); if (canonical.empty ()) @@ -281,7 +281,7 @@ cooked_index::handle_gnat_encoded_entry (cooked_index_entry *entry, /* See cooked-index.h. */ void -cooked_index::do_finalize () +cooked_index_shard::do_finalize () { auto hash_name_ptr = [] (const void *p) { @@ -378,8 +378,8 @@ cooked_index::do_finalize () /* 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 (); @@ -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 fa7d8840d166..22fb0110ea27 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 () = 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. */ @@ -353,7 +353,7 @@ class cooked_index_vector : public dwarf_scanner_base /* A convenience typedef for the vector that is contained in this object. */ - typedef std::vector> vec_type; + using vec_type = std::vector>; explicit cooked_index_vector (vec_type &&vec); DISABLE_COPY_AND_ASSIGN (cooked_index_vector); @@ -378,7 +378,7 @@ class cooked_index_vector : public dwarf_scanner_base } /* A range over a vector of subranges. */ - typedef range_chain range; + using range = range_chain; /* 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 @@ class cooked_index_vector : public dwarf_scanner_base /* 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 6cee22a3faa6..9c7cb1e4dbca 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -6611,7 +6611,7 @@ class cooked_index_storage eq_cutu_reader, htab_delete_entry, xcalloc, xfree)), - m_index (new cooked_index) + m_index (new cooked_index_shard) { } @@ -6657,9 +6657,9 @@ class cooked_index_storage 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 release () + std::unique_ptr release () { m_index->install_addrmap (&m_addrmap); return std::move (m_index); @@ -6692,8 +6692,8 @@ class cooked_index_storage 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; /* A writeable addrmap being constructed by this scanner. */ addrmap_mutable m_addrmap; @@ -7102,7 +7102,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) cooked_index_storage index_storage; create_all_units (per_objfile); build_type_psymtabs (per_objfile, &index_storage); - std::vector> indexes; + std::vector> indexes; per_bfd->quick_file_names_table = create_quick_file_names_table (per_bfd->all_units.size ()); @@ -7128,7 +7128,7 @@ dwarf2_build_psymtabs_hard (dwarf2_per_objfile *per_objfile) 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, + using result_type = std::pair, std::vector>; std::vector results = gdb::parallel_for_each (1, per_bfd->all_units.begin (),