From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from simark.ca by simark.ca with LMTP id TXBZK9SdW2AWawAAWB0awg (envelope-from ) for ; Wed, 24 Mar 2021 16:15:16 -0400 Received: by simark.ca (Postfix, from userid 112) id A70171EF7C; Wed, 24 Mar 2021 16:15:16 -0400 (EDT) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on simark.ca X-Spam-Level: X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED, MAILING_LIST_MULTI,T_DKIM_INVALID,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from sourceware.org (server2.sourceware.org [8.43.85.97]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by simark.ca (Postfix) with ESMTPS id B88621EF5D for ; Wed, 24 Mar 2021 16:15:15 -0400 (EDT) Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 598693851C24; Wed, 24 Mar 2021 20:15:15 +0000 (GMT) Received: from gateway30.websitewelcome.com (gateway30.websitewelcome.com [192.185.180.41]) by sourceware.org (Postfix) with ESMTPS id 64AEE3851C24 for ; Wed, 24 Mar 2021 20:15:12 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 64AEE3851C24 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=fail smtp.mailfrom=tom@tromey.com Received: from cm14.websitewelcome.com (cm14.websitewelcome.com [100.42.49.7]) by gateway30.websitewelcome.com (Postfix) with ESMTP id E699A1213C for ; Wed, 24 Mar 2021 15:15:11 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id P9uJlGKCnw11MP9uJl7Bst; Wed, 24 Mar 2021 15:15:11 -0500 X-Authority-Reason: nr=8 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To:Content-Type:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=8wKETI8L+yQbkOaUIOFxTz7OqSV85TxS3gzANJm4XOU=; b=iQz44mQSWZmq1Eb//G7b8SGrSa vKXpC6xEZzhm6VPSC65TMA6JL5KDBia1naGNaetS+VXlwfMuSs4dKgNm8YAS23E39Kf0FNr3OhAoF M+xHsRE6hwVeM2ziQmf+hzpqF; Received: from 71-211-130-165.hlrn.qwest.net ([71.211.130.165]:52838 helo=localhost.localdomain) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.93) (envelope-from ) id 1lP9uJ-001x1i-IC; Wed, 24 Mar 2021 14:15:11 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Subject: [PATCH 2/2] Simplify psymbol_functions::expand_symtabs_matching Date: Wed, 24 Mar 2021 14:15:10 -0600 Message-Id: <20210324201510.23655-3-tom@tromey.com> X-Mailer: git-send-email 2.26.2 In-Reply-To: <20210324201510.23655-1-tom@tromey.com> References: <20210324201510.23655-1-tom@tromey.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.130.165 X-Source-L: No X-Exim-ID: 1lP9uJ-001x1i-IC X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-130-165.hlrn.qwest.net (localhost.localdomain) [71.211.130.165]:52838 X-Source-Auth: tom+tromey.com X-Email-Count: 3 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes 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: , Cc: Tom Tromey Errors-To: gdb-patches-bounces@sourceware.org Sender: "Gdb-patches" I noticed that psymbol_functions::expand_symtabs_matching calls make_ignore_params once per psymtab that is matched. This seems possibly expensive, so this patch hoists the call out of the loop. gdb/ChangeLog 2021-03-24 Tom Tromey * psymtab.c (psymbol_functions::expand_symtabs_matching): Only call make_ignore_params once. --- gdb/ChangeLog | 5 +++++ gdb/psymtab.c | 6 +++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/gdb/psymtab.c b/gdb/psymtab.c index 5a64166d983..1ea7376a8c8 100644 --- a/gdb/psymtab.c +++ b/gdb/psymtab.c @@ -1306,6 +1306,10 @@ psymbol_functions::expand_symtabs_matching for (partial_symtab *ps : require_partial_symbols (objfile)) ps->searched_flag = PST_NOT_SEARCHED; + gdb::optional psym_lookup_name; + if (lookup_name != nullptr) + psym_lookup_name = lookup_name->make_ignore_params (); + for (partial_symtab *ps : m_partial_symtabs->range ()) { QUIT; @@ -1335,7 +1339,7 @@ psymbol_functions::expand_symtabs_matching if ((symbol_matcher == NULL && lookup_name == NULL) || recursively_search_psymtabs (ps, objfile, domain, - lookup_name->make_ignore_params (), + *psym_lookup_name, symbol_matcher)) { struct compunit_symtab *symtab = -- 2.26.2