Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom Tromey <tom@tromey.com>
To: Simon Marchi <simark@simark.ca>
Cc: Tom Tromey <tom@tromey.com>,
	 gdb-patches@sourceware.org,  macro@mips.com
Subject: Re: [RFA 1/2] Make line tables independent of progspace
Date: Wed, 28 Mar 2018 05:02:00 -0000	[thread overview]
Message-ID: <87muysx06b.fsf@tromey.com> (raw)
In-Reply-To: <bd32c496-efff-db2c-1c0b-d1de276d356c@simark.ca> (Simon Marchi's	message of "Tue, 27 Mar 2018 23:34:33 -0400")

>>>>> "Simon" == Simon Marchi <simark@simark.ca> 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


  reply	other threads:[~2018-03-28  5:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-21 17:18 [RFA 0/2] " Tom Tromey
2018-03-21 17:18 ` [RFA 2/2] Constify the line table Tom Tromey
2018-03-21 17:18 ` [RFA 1/2] Make line tables independent of progspace Tom Tromey
2018-03-24  3:40   ` Simon Marchi
2018-03-27  4:16     ` Tom Tromey
2018-03-27  4:53       ` Tom Tromey
2018-03-27 20:22         ` Simon Marchi
2018-03-28  4:53           ` Tom Tromey
2018-03-28 12:30             ` Simon Marchi
2018-03-28  3:34         ` Simon Marchi
2018-03-28  5:02           ` Tom Tromey [this message]
2018-03-28 12:32             ` Simon Marchi
2018-03-28 19:33           ` Maciej W. Rozycki
2018-03-29 15:04             ` Simon Marchi
2018-03-29 21:07               ` Maciej W. Rozycki
2018-04-26 21:30                 ` Tom Tromey
2018-05-03 23:17                   ` Maciej W. Rozycki
2018-05-14 23:54                     ` Maciej W. Rozycki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87muysx06b.fsf@tromey.com \
    --to=tom@tromey.com \
    --cc=gdb-patches@sourceware.org \
    --cc=macro@mips.com \
    --cc=simark@simark.ca \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox