From: Tom Tromey <tromey@redhat.com>
To: Phil Muldoon <pmuldoon@redhat.com>
Cc: "gdb-patches\@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [patch] Convert frame_stash to a hash table
Date: Thu, 16 May 2013 13:42:00 -0000 [thread overview]
Message-ID: <871u9711nn.fsf@fleche.redhat.com> (raw)
In-Reply-To: <5194DA88.6020705@redhat.com> (Phil Muldoon's message of "Thu, 16 May 2013 14:09:28 +0100")
>>>>> "Phil" == Phil Muldoon <pmuldoon@redhat.com> writes:
Phil> I think this patch improves the frame_stash "with filters" without
Phil> affecting "no filters" performance.
Phil> Tested on x8664 with no regressions.
Phil> What do you think?
Thanks, Phil. I appreciate this.
A few nits below.
Phil> +/* A frame stash used to speed up frame lookups. Create a hash table
Phil> + to stash frames previously accessed from the frame cache for
Phil> + quicker subsequent retrieval. The hash table is emptied whenever
Phil> + the frame cache is invalidated. */
Phil> +static htab_t frame_stash;
We use a blank line between the intro comment and the definition now.
This applies elsewhere.
Phil> + if (! f_id.stack_addr_p && ! f_id.code_addr_p && ! f_id.special_addr)
Phil> + gdb_assert ("Cannot calculate hash for frame_id.");
This assert will never fail, since its argument is true.
You want:
gdb_assert (f_id.stack_addr_p || f_id.code_addr_p || f_id.special_addr_p);
Also note the missing "_p" from special_addr_p in the patch.
Phil> + if (f_id.stack_addr_p == 1)
These are booleans so don't compare against 1.
Phil> + slot = (struct frame_info **) htab_find_slot (frame_stash,
Phil> + frame,
Phil> + INSERT);
Phil> + if (*slot != frame)
Phil> + *slot = frame;
I think you might as well assign unconditionally.
Otherwise I think readers will wonder when this can happen.
But, I think it can't happen.
Alternatively, if it can happen, then we need a comment.
thanks,
Tom
next prev parent reply other threads:[~2013-05-16 13:42 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-05-16 13:09 Phil Muldoon
2013-05-16 13:42 ` Pedro Alves
2013-05-16 13:50 ` Phil Muldoon
2013-05-16 14:23 ` Pedro Alves
2013-05-16 14:27 ` Phil Muldoon
2013-05-16 14:41 ` Pedro Alves
2013-05-16 14:54 ` Phil Muldoon
2013-05-16 18:44 ` Pedro Alves
2013-05-16 13:42 ` Tom Tromey [this message]
2013-05-16 14:17 ` Phil Muldoon
2013-05-16 18:16 ` Tom Tromey
2013-05-16 19:03 ` Phil Muldoon
2013-05-16 19:07 ` Tom Tromey
2013-05-16 19:27 ` Phil Muldoon
2013-05-16 20:23 ` Tom Tromey
2013-05-17 8:39 ` Phil Muldoon
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=871u9711nn.fsf@fleche.redhat.com \
--to=tromey@redhat.com \
--cc=gdb-patches@sourceware.org \
--cc=pmuldoon@redhat.com \
/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