Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Pedro Alves <palves@redhat.com>
To: Andrew Burgess <andrew.burgess@embecosm.com>, gdb-patches@sourceware.org
Cc: jimw@sifive.com, palmer@sifive.com, jhb@FreeBSD.org
Subject: Re: [PATCH 3/4] gdb/riscv: Create each unique target description only once
Date: Thu, 29 Nov 2018 18:12:00 -0000	[thread overview]
Message-ID: <6277aa2c-c64e-e7d2-07d9-444ce80ef170@redhat.com> (raw)
In-Reply-To: <84ce42bd83dc3d67bd312c4c8772171dd5bf1182.1543509416.git.andrew.burgess@embecosm.com>

On 11/29/2018 04:48 PM, Andrew Burgess wrote:

> +
> +  /* Add TDESC into the cache, a target description created to match
> +     FEATURES.  */
> +  void add (const struct riscv_gdbarch_features features,
> +            const target_desc *tdesc)
> +  {
> +    feature_tdesc_pair p (features, tdesc);
> +    m_tdesc_list.push_back (p);
> +  }
> +
> +private:
> +
> +  /* Map from a feature set to the corresponding target description.  */
> +  typedef std::pair<const struct riscv_gdbarch_features,
> +                    const target_desc *> feature_tdesc_pair;
> +
> +  /* List of all target descriptions we've previously seen.  */
> +  std::vector<feature_tdesc_pair> m_tdesc_list;
> +};

Did you consider an unordered_map instead of this whole class here?
See xml-tdesc.c's xml_cache.  If there's a reason the custom data
structure is preferred, I think that warrants a comment.

Thanks,
Pedro Alves


  reply	other threads:[~2018-11-29 18:12 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 22:50 [RFC] gdb/riscv: Add read_description method for riscv_linux_nat_target Andrew Burgess
2018-11-28 23:37 ` Jim Wilson
2018-11-29  2:23 ` Jim Wilson
2018-11-29 16:50   ` [PATCH 2/4] gdb/riscv: Add equality operators to riscv_gdb_features Andrew Burgess
2018-11-29 16:50   ` [PATCH 4/4] gdb/riscv: Add read_description method for riscv_linux_nat_target Andrew Burgess
2018-11-29 22:22     ` Jim Wilson
2018-11-29 16:50   ` [PATCH 3/4] gdb/riscv: Create each unique target description only once Andrew Burgess
2018-11-29 18:12     ` Pedro Alves [this message]
2018-11-29 19:17       ` Andrew Burgess
2018-11-29 22:32       ` Andrew Burgess
2018-11-30 17:07         ` Pedro Alves
2018-11-29 16:50   ` [PATCH 0/4] Re: gdb/riscv: Add read_description method for riscv_linux_nat_target Andrew Burgess
2018-11-29 16:50   ` [PATCH 1/4] gdb/riscv: Make some target description functions constant Andrew Burgess

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=6277aa2c-c64e-e7d2-07d9-444ce80ef170@redhat.com \
    --to=palves@redhat.com \
    --cc=andrew.burgess@embecosm.com \
    --cc=gdb-patches@sourceware.org \
    --cc=jhb@FreeBSD.org \
    --cc=jimw@sifive.com \
    --cc=palmer@sifive.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