Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Doug Evans <dje@google.com>
To: Joel Brobecker <brobecker@adacore.com>
Cc: gdb-patches@sourceware.org
Subject: Re: [RFA/PATCH] PR/9711: quadratic slowdown for deep stack traces
Date: Mon, 07 Sep 2009 07:30:00 -0000	[thread overview]
Message-ID: <e394668d0909070029k3cf20610hfc0c341e9c2c7ca3@mail.gmail.com> (raw)
In-Reply-To: <20090903183658.GJ4343@adacore.com>

On Thu, Sep 3, 2009 at 11:36 AM, Joel Brobecker<brobecker@adacore.com> wrote:
> 2009-09-03  Joel Brobecker  <brobecker@adacore.com>
>
>        Avoid quadratic behavior when computing the value of a register.
>        * frame.c (frame_cache): New static constant.
>        (frame_cache_add, frame_cache_find, frame_cache_invalidate):
>        New functions.
>        (get_frame_id): Minor reformatting. Add the frame to the frame cache.
>        (frame_find_by_id): Search the frame cache first before walking all
>        frames starting from te current_frame.
>        (reinit_frame_cache): Add call to frame_cache_invalidate ();

Hi.

Nit: It seems like there's a redundant call to frame_id_eq in frame_find_by_id.

+/* Search the frame cache for an entry with the given frame ID.
+   If found, return that frame.  Otherwise return NULL.  */
+static struct frame_info *
+frame_cache_find (struct frame_id id)
+{
+  if (frame_cache && frame_id_eq (frame_cache->this_id.value, id))
+    return frame_cache;
+
+  return NULL;
+}

@@ -514,6 +547,11 @@ frame_find_by_id (struct frame_id id)
   if (!frame_id_p (id))
     return NULL;

+  /* Try using the frame cache first.  */
+  frame = frame_cache_find (id);
+  if (frame && frame_id_eq (frame->this_id.value, id))
+    return frame;
+
   for (frame = get_current_frame (); ; frame = prev_frame)
     {
       struct frame_id this = get_frame_id (frame);


  parent reply	other threads:[~2009-09-07  7:30 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-09-03 18:37 Joel Brobecker
2009-09-03 20:27 ` Tom Tromey
2009-09-07  7:30 ` Doug Evans [this message]
2009-09-07 20:33   ` Joel Brobecker
2009-09-07 20:48     ` Doug Evans
2009-09-07 20:57     ` Pedro Alves
2009-09-07 22:00       ` Joel Brobecker
2009-09-07 22:21         ` Pedro Alves
2009-09-07 23:12           ` Joel Brobecker
2009-09-08  0:06             ` Joel Brobecker
2009-09-09 17:39               ` Joel Brobecker

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=e394668d0909070029k3cf20610hfc0c341e9c2c7ca3@mail.gmail.com \
    --to=dje@google.com \
    --cc=brobecker@adacore.com \
    --cc=gdb-patches@sourceware.org \
    /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