From patchwork Wed Feb 19 20:58:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Marchi X-Patchwork-Id: 38245 Received: (qmail 86435 invoked by alias); 19 Feb 2020 20:58:17 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 86427 invoked by uid 89); 19 Feb 2020 20:58:17 -0000 Authentication-Results: sourceware.org; auth=none X-Spam-SWARE-Status: No, score=-23.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_0, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, SPF_PASS autolearn=ham version=3.3.1 spammy=our X-HELO: mail.efficios.com Received: from mail.efficios.com (HELO mail.efficios.com) (167.114.26.124) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 19 Feb 2020 20:58:15 +0000 Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id C0DC424D663 for ; Wed, 19 Feb 2020 15:58:13 -0500 (EST) Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id 8won5kBHHNRP; Wed, 19 Feb 2020 15:58:13 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mail.efficios.com (Postfix) with ESMTP id 606C224D3D1; Wed, 19 Feb 2020 15:58:13 -0500 (EST) DKIM-Filter: OpenDKIM Filter v2.10.3 mail.efficios.com 606C224D3D1 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=efficios.com; s=default; t=1582145893; bh=UUjVpZ94LDE3bitUEXropk4XVLclUrqH5Qzcxa8HWYc=; h=From:To:Date:Message-Id:MIME-Version; b=Ng8dfB+Q1cZVzExaiY9G1OPMrDyLn/wUCKi0JIa/LRB4mbStMuoHwhWqIO7W6gA8Q iSohKek9zLDTtR0R7+o9ZpWz8t8Zx/0HHw/iq3OhdR2Mh7Q9rPGpfPBY+SK+8HqesJ 6RycLqz27gVCW/qNXQDJecR2iDjpssTEsWVOwbj4D9I7JuLOuxD0nSnSH+gnYNgKvD dnGS0KuuYQsH/IVxQXFDu8gRC9PYtiQy4RwpcwVdwdpfQBne3BAIDLELjcfWZ5XNht isPBM6n4M7vWBsu7oTmMI+WJe4xrLiKaja4BZDx5xa4yA0BPRl80ZAoQWVmqQm+PRS Aw8/SZJf8ODlw== Received: from mail.efficios.com ([127.0.0.1]) by localhost (mail03.efficios.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id 5uG1M4VbXqQs; Wed, 19 Feb 2020 15:58:13 -0500 (EST) Received: from smarchi-efficios.internal.efficios.com (192-222-181-218.qc.cable.ebox.net [192.222.181.218]) by mail.efficios.com (Postfix) with ESMTPSA id 2A96D24D56D; Wed, 19 Feb 2020 15:58:13 -0500 (EST) From: Simon Marchi To: gdb-patches@sourceware.org Cc: Simon Marchi Subject: [PATCH] gdb: dwarf2/read.c: remove unused objfile parameters/variables Date: Wed, 19 Feb 2020 15:58:06 -0500 Message-Id: <20200219205806.31097-1-simon.marchi@efficios.com> MIME-Version: 1.0 This is a simple cleanup. These functions used to use the objfile's obstack for allocation in the hash tables, but they don't anymore. Remove the unnecessary objfile parameters, which in turn allows removing some local variables. gdb/ChangeLog: * dwarf2/read.c (allocate_signatured_type_table, allocate_dwo_unit_table, allocate_type_unit_groups_table, allocate_dwo_file_hash_table, allocate_dwp_loaded_cutus_table): Remove objfile parameter, update all callers. --- gdb/dwarf2/read.c | 53 +++++++++++++++++------------------------------ 1 file changed, 19 insertions(+), 34 deletions(-) diff --git a/gdb/dwarf2/read.c b/gdb/dwarf2/read.c index ee220ab70b33..4d767a59af74 100644 --- a/gdb/dwarf2/read.c +++ b/gdb/dwarf2/read.c @@ -1650,9 +1650,9 @@ struct file_and_directory static file_and_directory find_file_and_directory (struct die_info *die, struct dwarf2_cu *cu); -static htab_up allocate_signatured_type_table (struct objfile *objfile); +static htab_up allocate_signatured_type_table (); -static htab_up allocate_dwo_unit_table (struct objfile *objfile); +static htab_up allocate_dwo_unit_table (); static struct dwo_unit *lookup_dwo_unit_in_dwp (struct dwarf2_per_objfile *dwarf2_per_objfile, @@ -2499,7 +2499,7 @@ create_signatured_type_table_from_index gdb_assert (dwarf2_per_objfile->all_type_units.empty ()); dwarf2_per_objfile->all_type_units.reserve (elements / 3); - htab_up sig_types_hash = allocate_signatured_type_table (objfile); + htab_up sig_types_hash = allocate_signatured_type_table (); for (offset_type i = 0; i < elements; i += 3) { @@ -2555,7 +2555,7 @@ create_signatured_type_table_from_debug_names gdb_assert (dwarf2_per_objfile->all_type_units.empty ()); dwarf2_per_objfile->all_type_units.reserve (map.tu_count); - htab_up sig_types_hash = allocate_signatured_type_table (objfile); + htab_up sig_types_hash = allocate_signatured_type_table (); for (uint32_t i = 0; i < map.tu_count; ++i) { @@ -5973,7 +5973,7 @@ eq_signatured_type (const void *item_lhs, const void *item_rhs) /* Allocate a hash table for signatured types. */ static htab_up -allocate_signatured_type_table (struct objfile *objfile) +allocate_signatured_type_table () { return htab_up (htab_create_alloc (41, hash_signatured_type, @@ -6068,9 +6068,9 @@ create_debug_type_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile, if (types_htab == NULL) { if (dwo_file) - types_htab = allocate_dwo_unit_table (objfile); + types_htab = allocate_dwo_unit_table (); else - types_htab = allocate_signatured_type_table (objfile); + types_htab = allocate_signatured_type_table (); } if (dwo_file) @@ -6281,7 +6281,6 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) { struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_cu->dwarf2_per_objfile; - struct objfile *objfile = dwarf2_per_objfile->objfile; struct dwo_file *dwo_file; struct dwo_unit find_dwo_entry, *dwo_entry; struct signatured_type find_sig_entry, *sig_entry; @@ -6292,10 +6291,7 @@ lookup_dwo_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) /* If TU skeletons have been removed then we may not have read in any TUs yet. */ if (dwarf2_per_objfile->signatured_types == NULL) - { - dwarf2_per_objfile->signatured_types - = allocate_signatured_type_table (objfile); - } + dwarf2_per_objfile->signatured_types = allocate_signatured_type_table (); /* We only ever need to read in one copy of a signatured type. Use the global signatured_types array to do our own comdat-folding @@ -6352,7 +6348,6 @@ lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) { struct dwarf2_per_objfile *dwarf2_per_objfile = cu->per_cu->dwarf2_per_objfile; - struct objfile *objfile = dwarf2_per_objfile->objfile; struct dwp_file *dwp_file = get_dwp_file (dwarf2_per_objfile); struct dwo_unit *dwo_entry; struct signatured_type find_sig_entry, *sig_entry; @@ -6364,10 +6359,7 @@ lookup_dwp_signatured_type (struct dwarf2_cu *cu, ULONGEST sig) /* If TU skeletons have been removed then we may not have read in any TUs yet. */ if (dwarf2_per_objfile->signatured_types == NULL) - { - dwarf2_per_objfile->signatured_types - = allocate_signatured_type_table (objfile); - } + dwarf2_per_objfile->signatured_types = allocate_signatured_type_table (); find_sig_entry.signature = sig; slot = htab_find_slot (dwarf2_per_objfile->signatured_types.get (), @@ -7087,7 +7079,7 @@ eq_type_unit_group (const void *item_lhs, const void *item_rhs) /* Allocate a hash table for type unit groups. */ static htab_up -allocate_type_unit_groups_table (struct objfile *objfile) +allocate_type_unit_groups_table () { return htab_up (htab_create_alloc (3, hash_type_unit_group, @@ -7161,10 +7153,7 @@ get_type_unit_group (struct dwarf2_cu *cu, const struct attribute *stmt_list) struct type_unit_group type_unit_group_for_lookup; if (dwarf2_per_objfile->type_unit_groups == NULL) - { - dwarf2_per_objfile->type_unit_groups = - allocate_type_unit_groups_table (dwarf2_per_objfile->objfile); - } + dwarf2_per_objfile->type_unit_groups = allocate_type_unit_groups_table (); /* Do we need to create a new group, or can we use an existing one? */ @@ -7638,10 +7627,7 @@ process_skeletonless_type_unit (void **slot, void *info) /* If this TU doesn't exist in the global table, add it and read it in. */ if (dwarf2_per_objfile->signatured_types == NULL) - { - dwarf2_per_objfile->signatured_types - = allocate_signatured_type_table (dwarf2_per_objfile->objfile); - } + dwarf2_per_objfile->signatured_types = allocate_signatured_type_table (); find_entry.signature = dwo_unit->signature; slot = htab_find_slot (dwarf2_per_objfile->signatured_types.get (), @@ -10986,7 +10972,7 @@ eq_dwo_file (const void *item_lhs, const void *item_rhs) /* Allocate a hash table for DWO files. */ static htab_up -allocate_dwo_file_hash_table (struct objfile *objfile) +allocate_dwo_file_hash_table () { auto delete_dwo_file = [] (void *item) { @@ -11013,8 +10999,7 @@ lookup_dwo_file_slot (struct dwarf2_per_objfile *dwarf2_per_objfile, void **slot; if (dwarf2_per_objfile->dwo_files == NULL) - dwarf2_per_objfile->dwo_files - = allocate_dwo_file_hash_table (dwarf2_per_objfile->objfile); + dwarf2_per_objfile->dwo_files = allocate_dwo_file_hash_table (); find_entry.dwo_name = dwo_name; find_entry.comp_dir = comp_dir; @@ -11050,7 +11035,7 @@ eq_dwo_unit (const void *item_lhs, const void *item_rhs) There is one of these tables for each of CUs,TUs for each DWO file. */ static htab_up -allocate_dwo_unit_table (struct objfile *objfile) +allocate_dwo_unit_table () { /* Start out with a pretty small number. Generally DWO files contain only one CU and maybe some TUs. */ @@ -11144,7 +11129,7 @@ create_cus_hash_table (struct dwarf2_per_objfile *dwarf2_per_objfile, continue; if (cus_htab == NULL) - cus_htab = allocate_dwo_unit_table (objfile); + cus_htab = allocate_dwo_unit_table (); dwo_unit = OBSTACK_ZALLOC (&objfile->objfile_obstack, struct dwo_unit); *dwo_unit = read_unit; @@ -12301,7 +12286,7 @@ eq_dwp_loaded_cutus (const void *a, const void *b) /* Allocate a hash table for dwp_file loaded CUs/TUs. */ static htab_up -allocate_dwp_loaded_cutus_table (struct objfile *objfile) +allocate_dwp_loaded_cutus_table () { return htab_up (htab_create_alloc (3, hash_dwp_loaded_cutus, @@ -12434,8 +12419,8 @@ open_and_init_dwp_file (struct dwarf2_per_objfile *dwarf2_per_objfile) dwarf2_locate_v2_dwp_sections, dwp_file.get ()); - dwp_file->loaded_cus = allocate_dwp_loaded_cutus_table (objfile); - dwp_file->loaded_tus = allocate_dwp_loaded_cutus_table (objfile); + dwp_file->loaded_cus = allocate_dwp_loaded_cutus_table (); + dwp_file->loaded_tus = allocate_dwp_loaded_cutus_table (); if (dwarf_read_debug) {