Received: from eggs.gnu.org ([2001:4830:134:3::10]:38662) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b10lG-0001oa-S5 for qemu-devel@nongnu.org; Thu, 12 May 2016 20:15:24 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1b10lF-0002yy-KU for qemu-devel@nongnu.org; Thu, 12 May 2016 20:15:22 -0400 Received: from mail-qk0-x242.google.com ([2607:f8b0:400d:c09::242]:34179) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1b10lF-0002ys-G3 for qemu-devel@nongnu.org; Thu, 12 May 2016 20:15:21 -0400 Received: by mail-qk0-x242.google.com with SMTP id i7so7139936qkd.1 for ; Thu, 12 May 2016 17:15:21 -0700 (PDT) Sender: Richard Henderson From: Richard Henderson Date: Thu, 12 May 2016 14:13:24 -1000 Message-Id: <1463098420-29113-24-git-send-email-rth@twiddle.net> In-Reply-To: <1463098420-29113-1-git-send-email-rth@twiddle.net> References: <1463098420-29113-1-git-send-email-rth@twiddle.net> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Subject: [Qemu-devel] [PULL 23/39] tcg: Clean up tb_jmp_unlink() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org Cc: peter.maydell@linaro.org, Sergey Fedorov , Sergey Fedorov From: Sergey Fedorov Unify the code of this function with tb_jmp_remove_from_list(). Making these functions similar improves their readability. Also this could be a step towards making this function thread-safe. Signed-off-by: Sergey Fedorov Signed-off-by: Sergey Fedorov Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- translate-all.c | 21 +++++++++------------ 1 file changed, 9 insertions(+), 12 deletions(-) diff --git a/translate-all.c b/translate-all.c index 9a57aab..d679ad1 100644 --- a/translate-all.c +++ b/translate-all.c @@ -965,25 +965,22 @@ static inline void tb_reset_jump(TranslationBlock *tb, int n) /* remove any jumps to the TB */ static inline void tb_jmp_unlink(TranslationBlock *tb) { - uintptr_t tb1, tb2; + TranslationBlock *tb1; + uintptr_t *ptb, ntb; unsigned int n1; - tb1 = tb->jmp_list_first; + ptb = &tb->jmp_list_first; for (;;) { - TranslationBlock *tmp_tb; - n1 = tb1 & 3; + ntb = *ptb; + n1 = ntb & 3; + tb1 = (TranslationBlock *)(ntb & ~3); if (n1 == 2) { break; } - tmp_tb = (TranslationBlock *)(tb1 & ~3); - tb2 = tmp_tb->jmp_list_next[n1]; - tb_reset_jump(tmp_tb, n1); - tmp_tb->jmp_list_next[n1] = (uintptr_t)NULL; - tb1 = tb2; + tb_reset_jump(tb1, n1); + *ptb = tb1->jmp_list_next[n1]; + tb1->jmp_list_next[n1] = (uintptr_t)NULL; } - - assert(((uintptr_t)tb & 3) == 0); - tb->jmp_list_first = (uintptr_t)tb | 2; /* fail safe */ } /* invalidate one TB */ -- 2.5.5