From: Paolo Bonzini <pbonzini@redhat.com>
To: li guang <lig.fnst@cn.fujitsu.com>
Cc: peter.maydell@linaro.org, proljc@gmail.com,
e.voevodin@samsung.com, qemu-devel@nongnu.org,
blauwirbel@gmail.com, paul@codesourcery.com, afaerber@suse.de,
aurelien@aurel32.net, rth@twiddle.net
Subject: Re: [Qemu-devel] [PATCH] translate: cleanup gen_intermediate_code_internal
Date: Wed, 10 Apr 2013 11:54:06 +0200 [thread overview]
Message-ID: <516536BE.9060104@redhat.com> (raw)
In-Reply-To: <1365580536.9553.97.camel@liguang.fnst.cn.fujitsu.com>
Il 10/04/2013 09:55, li guang ha scritto:
> 在 2013-04-10三的 09:44 +0200,Paolo Bonzini写道:
>> Il 10/04/2013 05:30, liguang ha scritto:
>>> Signed-off-by: liguang <lig.fnst@cn.fujitsu.com>
>>> ---
>>> target-arm/translate.c | 17 ++++++++---------
>>> target-i386/translate.c | 17 ++++++++---------
>>> target-mips/translate.c | 16 ++++++++--------
>>> 3 files changed, 24 insertions(+), 26 deletions(-)
>>>
>>> diff --git a/target-arm/translate.c b/target-arm/translate.c
>>> index 35a21be..c0c080d 100644
>>> --- a/target-arm/translate.c
>>> +++ b/target-arm/translate.c
>>> @@ -9806,11 +9806,10 @@ static inline void gen_intermediate_code_internal(CPUARMState *env,
>>> cpu_M0 = tcg_temp_new_i64();
>>> next_page_start = (pc_start & TARGET_PAGE_MASK) + TARGET_PAGE_SIZE;
>>> lj = -1;
>>> - num_insns = 0;
>>
>> Nack. Did you even try to read what I and Wei-Ren Chen were trying to
>> tell you?
>>
>
> well, you ask if I tested, and I answer yes,
> you doubt if this line really could be removed,
> and I said compiler will not complain this.
I don't care if the compiler doesn't complain (though I doubt it
doesn't; are you using --enable-debug?). It is wrong.
You are removing the initialization of num_insns. The only instruction
that modifies it is now "num_insns++". That is wrong, period. Even if
GCC ends up producing code that works, what happens when you access
uninitialized memory is undefined.
> what should I do?
> Isn't it enough?
> did you read my answer for your comment?
You didn't reply to this message from Wei-Ren Chen:
>> I think 'max_insns = tb->cflags & CF_COUNT_MASK;' is enough
>> to feed compiler.
>
> num_insns and max_insns are two different variables, right? So this
> assignment does not do anything with num_insns.
So yes, I read your answers and no, they were not enough.
Paolo
next prev parent reply other threads:[~2013-04-10 9:54 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-04-10 3:30 [Qemu-devel] [PATCH] translate: cleanup gen_intermediate_code_internal liguang
2013-04-10 7:44 ` Paolo Bonzini
2013-04-10 7:55 ` li guang
2013-04-10 9:54 ` Paolo Bonzini [this message]
2013-04-11 2:11 ` li guang
2013-04-11 6:23 ` Paolo Bonzini
2013-04-11 6:42 ` li guang
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=516536BE.9060104@redhat.com \
--to=pbonzini@redhat.com \
--cc=afaerber@suse.de \
--cc=aurelien@aurel32.net \
--cc=blauwirbel@gmail.com \
--cc=e.voevodin@samsung.com \
--cc=lig.fnst@cn.fujitsu.com \
--cc=paul@codesourcery.com \
--cc=peter.maydell@linaro.org \
--cc=proljc@gmail.com \
--cc=qemu-devel@nongnu.org \
--cc=rth@twiddle.net \
/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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.