From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 56929 invoked by alias); 28 Mar 2018 05:02:26 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Received: (qmail 56919 invoked by uid 89); 28 Mar 2018 05:02:25 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS autolearn=ham version=3.3.2 spammy= X-HELO: gateway31.websitewelcome.com Received: from gateway31.websitewelcome.com (HELO gateway31.websitewelcome.com) (192.185.143.47) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 28 Mar 2018 05:02:23 +0000 Received: from cm13.websitewelcome.com (cm13.websitewelcome.com [100.42.49.6]) by gateway31.websitewelcome.com (Postfix) with ESMTP id 901F916C49B for ; Wed, 28 Mar 2018 00:02:22 -0500 (CDT) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with SMTP id 13E6f6VuKQUwq13E6fwOcs; Wed, 28 Mar 2018 00:02:22 -0500 Received: from 174-29-48-109.hlrn.qwest.net ([174.29.48.109]:50506 helo=bapiya) by box5379.bluehost.com with esmtpsa (TLSv1.2:ECDHE-RSA-AES256-GCM-SHA384:256) (Exim 4.89_1) (envelope-from ) id 1f13E6-002E74-A3; Wed, 28 Mar 2018 00:02:22 -0500 From: Tom Tromey To: Simon Marchi Cc: Tom Tromey , gdb-patches@sourceware.org, macro@mips.com Subject: Re: [RFA 1/2] Make line tables independent of progspace References: <20180321171809.13115-1-tom@tromey.com> <20180321171809.13115-2-tom@tromey.com> <87zi2uw3uc.fsf@tromey.com> <87vadiw24a.fsf@tromey.com> Date: Wed, 28 Mar 2018 05:02:00 -0000 In-Reply-To: (Simon Marchi's message of "Tue, 27 Mar 2018 23:34:33 -0400") Message-ID: <87muysx06b.fsf@tromey.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/26.0.91 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain X-BWhitelist: no X-Source-L: No X-Exim-ID: 1f13E6-002E74-A3 X-Source-Sender: 174-29-48-109.hlrn.qwest.net (bapiya) [174.29.48.109]:50506 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-SW-Source: 2018-03/txt/msg00584.txt.bz2 >>>>> "Simon" == Simon Marchi writes: >> + auto pc_compare = [=](const CORE_ADDR & pc, >> + const struct linetable_entry & lhs)->bool >> { >> - return pc < lhs.pc; >> + return pc < lhs.address (iter_s); >> }; Simon> Since we know this will be called many times and address() is substantially Simon> more costly than just reading a CORE_ADDR field, maybe it would be good to Simon> save it to a variable before and use that in the lambda. I am not sure this would work, because LHS is what changes here -- std::upper_bound is searching through the line table looking for a match. One idea might be to "unrelocate" PC to do the search. This would make the search more efficient. I will try this. Simon> I was also thinking Simon> the same thing for the various other calls to address() in this function, since Simon> sometimes the same value is recomputed multiple times. I suppose most work could be done on the unrelocated form, with the address computation happening only at the end. >> + /* Set the members of this object from another linetable_entry. */ >> + void set (const linetable_entry &other) >> + { >> + m_line = other.m_line; >> + m_pc = other.m_pc; >> + } Simon> This really looks like an assignment operator (the default one would be Simon> enough). Is there a reason to have this set overload? Either way works, Simon> I'm just curious. I just did it to keep the names consistent, but I will change it to use the default operator=. >> - newLineTb->item[newline] = oldLineTb->item[jj]; >> - newLineTb->item[newline].line = oldLineTb->item[jj + 1].line; >> + newLineTb->item[newline].set (oldLineTb->item[jj].raw_address (), >> + oldLineTb->item[jj + 1].line ()); Simon> The address and the line are inverted here. Bleah. Thanks again. Tom