Switch the roles of jmp_next[0] and jmp_next[1].
PATCH 1/1 Switch the roles of jmp_next[0] and jmp_next[1].
This way, jmp_next[0] means "taken" for both conditional jumps AND unconditional jumps. Currently, it has opposite meanings for the two cases.
--- target-i386/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
target-i386/translate.c +2 -2
@@ -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 ();
Signature · 1 line
1.8.1.2
Quoted 2 lines · Zhihui Zhang
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
Quoted 2 lines · Zhihui Zhang
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~
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.
Quoted 10 lines · Richard Henderson
Quoted 1 line · Zhihui Zhang
This way, jmp_next[0] means "taken" for both conditional jumps AND
unconditional jumps.
Quoted 1 line
Currently, it has opposite meanings for the two cases.
So? There's no proscribed meaning for the 0 and 1 indices.
r~