qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] [PATCH 3/4] change while to if
Date: Fri, 15 Jan 2010 09:42:09 +0100	[thread overview]
Message-ID: <1263544930-18620-4-git-send-email-pbonzini@redhat.com> (raw)
In-Reply-To: <1263544930-18620-1-git-send-email-pbonzini@redhat.com>

The while loop will be executed exactly 0 or 1 times, depending on
env->exit_request.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 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

  parent reply	other threads:[~2010-01-15  8:42 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-01-15  8:42 [Qemu-devel] [PATCH 0/4] Clean up cpu_exec part 2/n Paolo Bonzini
2010-01-15  8:42 ` [Qemu-devel] [PATCH 1/4] clean up env->current_tb Paolo Bonzini
2010-01-19 22:40   ` Anthony Liguori
2010-01-15  8:42 ` [Qemu-devel] [PATCH 2/4] add assertions about env->current_tb Paolo Bonzini
2010-01-15  8:42 ` Paolo Bonzini [this message]
2010-01-15  8:42 ` [Qemu-devel] [PATCH 4/4] remove assertions Paolo Bonzini

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1263544930-18620-4-git-send-email-pbonzini@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).