qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Laurent Desnogues <laurent.desnogues@gmail.com>
To: Juha.Riihimaki@nokia.com
Cc: qemu-devel@nongnu.org
Subject: Re: [Qemu-devel] [PATCH 01/12] target-arm: fix resource leak in gen_set_cpsr macro
Date: Wed, 21 Oct 2009 12:48:10 +0200	[thread overview]
Message-ID: <761ea48b0910210348g2d8a450l7aede31e7ed23dc9@mail.gmail.com> (raw)
In-Reply-To: <59832F36-4565-4EEA-9BC7-844463C2BE3B@nokia.com>

On Wed, Oct 21, 2009 at 12:17 PM,  <Juha.Riihimaki@nokia.com> wrote:
> Current implementation of the gen_set_cpsr macro creates a new
> temporary tcg variable through the tcg_const_i32 call but never marks
> it dead.
>
> Signed-off-by: Juha Riihimäki <juha.riihimaki@nokia.com>
> ---
> diff --git a/target-arm/translate.c b/target-arm/translate.c
> index bc51bcb..bda105e 100644
> --- a/target-arm/translate.c
> +++ b/target-arm/translate.c
> @@ -184,7 +184,12 @@ static void store_reg(DisasContext *s, int reg,
> TCGv var)
>  #define gen_uxtb16(var) gen_helper_uxtb16(var, var)
>
>
> -#define gen_set_cpsr(var, mask) gen_helper_cpsr_write(var,
> tcg_const_i32(mask))
> +#define gen_set_cpsr(var, mask) \
> +{ \
> +    TCGv tmp_mask = tcg_const_i32(mask); \
> +    gen_helper_cpsr_write(var, tmp_mask); \
> +    tcg_temp_free_i32(tmp_mask); \
> +}
>  /* Set NZCV flags from the high 4 bits of var.  */
>  #define gen_set_nzcv(var) gen_set_cpsr(var, CPSR_NZCV)

Again personal taste:  why not make gen_set_cpsr a static
inline function.

Apart from that, it's OK.


Laurent

      reply	other threads:[~2009-10-21 10:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-21 10:17 [Qemu-devel] [PATCH 01/12] target-arm: fix resource leak in gen_set_cpsr macro Juha.Riihimaki
2009-10-21 10:48 ` Laurent Desnogues [this message]

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=761ea48b0910210348g2d8a450l7aede31e7ed23dc9@mail.gmail.com \
    --to=laurent.desnogues@gmail.com \
    --cc=Juha.Riihimaki@nokia.com \
    --cc=qemu-devel@nongnu.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;
as well as URLs for NNTP newsgroup(s).