From patchwork Fri Jan 15 08:42:09 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 42955 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.gnu.org (lists.gnu.org [199.232.76.165]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by ozlabs.org (Postfix) with ESMTPS id 9C1F4B7CA0 for ; Fri, 15 Jan 2010 19:48:01 +1100 (EST) Received: from localhost ([127.0.0.1]:57872 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1NVhqY-0005wp-Q2 for incoming@patchwork.ozlabs.org; Fri, 15 Jan 2010 03:47:58 -0500 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 To: qemu-devel@nongnu.org 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> X-Scanned-By: MIMEDefang 2.67 on 10.5.11.17 X-detected-operating-system: by monty-python.gnu.org: Genre and OS details not recognized. Subject: [Qemu-devel] [PATCH 3/4] change while to if X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org Errors-To: qemu-devel-bounces+incoming=patchwork.ozlabs.org@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(;;) */