From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1NVhl5-0003p0-IG for qemu-devel@nongnu.org; Fri, 15 Jan 2010 03:42:19 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1NVhl1-0003kq-R1 for qemu-devel@nongnu.org; Fri, 15 Jan 2010 03:42:19 -0500 Received: from [199.232.76.173] (port=38980 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVhl1-0003kh-Nn for qemu-devel@nongnu.org; Fri, 15 Jan 2010 03:42:15 -0500 Received: from mx1.redhat.com ([209.132.183.28]:40183) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1NVhl1-0003vP-9P for qemu-devel@nongnu.org; Fri, 15 Jan 2010 03:42:15 -0500 Received: from int-mx04.intmail.prod.int.phx2.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.17]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o0F8gEVO018091 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Fri, 15 Jan 2010 03:42:14 -0500 Received: from localhost.localdomain (vpn2-8-52.ams2.redhat.com [10.36.8.52]) by int-mx04.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o0F8gAic030958 for ; Fri, 15 Jan 2010 03:42:13 -0500 From: Paolo Bonzini Date: Fri, 15 Jan 2010 09:42:09 +0100 Message-Id: <1263544930-18620-4-git-send-email-pbonzini@redhat.com> In-Reply-To: <1263544930-18620-1-git-send-email-pbonzini@redhat.com> References: <1263544930-18620-1-git-send-email-pbonzini@redhat.com> Subject: [Qemu-devel] [PATCH 3/4] change while to if List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org The while loop will be executed exactly 0 or 1 times, depending on env->exit_request. Signed-off-by: Paolo Bonzini --- cpu-exec.c | 10 +++------- 1 files changed, 3 insertions(+), 7 deletions(-) diff --git a/cpu-exec.c b/cpu-exec.c index d974141..f00151f 100644 --- a/cpu-exec.c +++ b/cpu-exec.c @@ -596,17 +596,13 @@ int cpu_exec(CPUState *env1) tb_add_jump((TranslationBlock *)(next_tb & ~3), next_tb & 3, tb); } spin_unlock(&tb_lock); - env->current_tb = tb; - assert (env->current_tb); /* cpu_interrupt might be called while translating the TB, but before it is linked into a potentially infinite loop and becomes env->current_tb. Avoid starting execution if there is a pending interrupt. */ - if (unlikely (env->exit_request)) - env->current_tb = NULL; - - while (env->current_tb) { + if (!unlikely (env->exit_request)) { + env->current_tb = tb; tc_ptr = tb->tc_ptr; /* execute the generated code */ #if defined(__sparc__) && !defined(CONFIG_SOLARIS) @@ -643,8 +639,8 @@ int cpu_exec(CPUState *env1) cpu_loop_exit(); } } - assert (env->current_tb == NULL); } + assert (env->current_tb == NULL); /* reset soft MMU for next block (it can currently only be set by a memory fault) */ } /* for(;;) */ -- 1.6.5.2