qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH] Switch the roles of jmp_next[0] and jmp_next[1].
@ 2013-06-22 16:10 Zhihui Zhang
  2013-06-22 22:04 ` Peter Maydell
  2013-06-23 18:22 ` Richard Henderson
  0 siblings, 2 replies; 4+ messages in thread
From: Zhihui Zhang @ 2013-06-22 16:10 UTC (permalink / raw)
  To: qemu-devel; +Cc: blauwirbel, rth

This way, jmp_next[0] means "taken" for both conditional jumps AND unconditional jumps.
Currently, it has opposite meanings for the two cases.

Signed-off-by: Zhihui Zhang <zzhsuny@gmail.com>
---
 target-i386/translate.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target-i386/translate.c b/target-i386/translate.c
index 14b0298..7daa1a1 100644
--- a/target-i386/translate.c
+++ b/target-i386/translate.c
@@ -2430,10 +2430,10 @@ static inline void gen_jcc(DisasContext *s, int b,
         l1 = gen_new_label();
         gen_jcc1(s, b, l1);
 
-        gen_goto_tb(s, 0, next_eip);
+        gen_goto_tb(s, 1, next_eip);
 
         gen_set_label(l1);
-        gen_goto_tb(s, 1, val);
+        gen_goto_tb(s, 0, val);
         s->is_jmp = DISAS_TB_JUMP;
     } else {
         l1 = gen_new_label();
-- 
1.8.1.2

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Switch the roles of jmp_next[0] and jmp_next[1].
  2013-06-22 16:10 [Qemu-devel] [PATCH] Switch the roles of jmp_next[0] and jmp_next[1] Zhihui Zhang
@ 2013-06-22 22:04 ` Peter Maydell
  2013-06-23 18:22 ` Richard Henderson
  1 sibling, 0 replies; 4+ messages in thread
From: Peter Maydell @ 2013-06-22 22:04 UTC (permalink / raw)
  To: Zhihui Zhang; +Cc: blauwirbel, qemu-devel, rth

On 22 June 2013 17:10, Zhihui Zhang <zzhsuny@gmail.com> wrote:
> This way, jmp_next[0] means "taken" for both conditional jumps AND unconditional jumps.
> Currently, it has opposite meanings for the two cases.

This commit message is missing a rationale: do you want
to do this because:
 * it fixes a bug? (if so, what bug)
 * it is more efficient? (if so, some description of why)
 * you just think it would be neater this way around?

How about the TB exit via gen_jz_ecx_string ?

thanks
-- PMM

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Switch the roles of jmp_next[0] and jmp_next[1].
  2013-06-22 16:10 [Qemu-devel] [PATCH] Switch the roles of jmp_next[0] and jmp_next[1] Zhihui Zhang
  2013-06-22 22:04 ` Peter Maydell
@ 2013-06-23 18:22 ` Richard Henderson
  2013-06-24  2:52   ` Zhihui Zhang
  1 sibling, 1 reply; 4+ messages in thread
From: Richard Henderson @ 2013-06-23 18:22 UTC (permalink / raw)
  To: Zhihui Zhang; +Cc: blauwirbel, qemu-devel

On 06/22/2013 09:10 AM, Zhihui Zhang wrote:
> This way, jmp_next[0] means "taken" for both conditional jumps AND unconditional jumps.
> Currently, it has opposite meanings for the two cases.

So?  There's no proscribed meaning for the 0 and 1 indices.


r~

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [Qemu-devel] [PATCH] Switch the roles of jmp_next[0] and jmp_next[1].
  2013-06-23 18:22 ` Richard Henderson
@ 2013-06-24  2:52   ` Zhihui Zhang
  0 siblings, 0 replies; 4+ messages in thread
From: Zhihui Zhang @ 2013-06-24  2:52 UTC (permalink / raw)
  To: Richard Henderson; +Cc: blauwirbel, qemu-devel

[-- Attachment #1: Type: text/plain, Size: 684 bytes --]

My intention was to make things consistent for readability.  In the case of
gen_jz_ecx_string(), jmp_next[1] is already the "not taken" case.  However,
looks like the meaning of jmp_next changes in the case of a TB loop, it
does not point to the next TB to execute any more. Anyway, I thought this
patch can reduce some confusion.


On Sun, Jun 23, 2013 at 2:22 PM, Richard Henderson <rth@twiddle.net> wrote:

> On 06/22/2013 09:10 AM, Zhihui Zhang wrote:
> > This way, jmp_next[0] means "taken" for both conditional jumps AND
> unconditional jumps.
> > Currently, it has opposite meanings for the two cases.
>
> So?  There's no proscribed meaning for the 0 and 1 indices.
>
>
> r~
>

[-- Attachment #2: Type: text/html, Size: 1117 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-06-24  2:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-06-22 16:10 [Qemu-devel] [PATCH] Switch the roles of jmp_next[0] and jmp_next[1] Zhihui Zhang
2013-06-22 22:04 ` Peter Maydell
2013-06-23 18:22 ` Richard Henderson
2013-06-24  2:52   ` Zhihui Zhang

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).