From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:38766) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhygh-0000BX-OQ for qemu-devel@nongnu.org; Thu, 08 Sep 2016 08:44:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bhygf-00046P-1d for qemu-devel@nongnu.org; Thu, 08 Sep 2016 08:44:15 -0400 Received: from mail-wm0-x234.google.com ([2a00:1450:400c:c09::234]:38822) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bhyge-00046L-Qy for qemu-devel@nongnu.org; Thu, 08 Sep 2016 08:44:12 -0400 Received: by mail-wm0-x234.google.com with SMTP id 1so86603213wmz.1 for ; Thu, 08 Sep 2016 05:44:12 -0700 (PDT) References: <1468917141-8155-1-git-send-email-pbonzini@redhat.com> <1468917141-8155-3-git-send-email-pbonzini@redhat.com> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1468917141-8155-3-git-send-email-pbonzini@redhat.com> Date: Thu, 08 Sep 2016 13:44:10 +0100 Message-ID: <87wpimy31h.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH 02/10] tcg: Pass last_tb by value to tb_find_fast() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: qemu-devel@nongnu.org, serge.fdrv@gmail.com, sergey.fedorov@linaro.org Paolo Bonzini writes: > From: Sergey Fedorov > > This is a small clean up. tb_find_fast() is a final consumer of this > variable so no need to pass it by reference. 'last_tb' is always updated > by subsequent cpu_loop_exec_tb() in cpu_exec(). > > @@ -621,7 +620,7 @@ int cpu_exec(CPUState *cpu) > cpu->tb_flushed = false; /* reset before first TB lookup */ > for(;;) { > cpu_handle_interrupt(cpu, &last_tb); > - tb = tb_find_fast(cpu, &last_tb, tb_exit); > + tb = tb_find_fast(cpu, last_tb, tb_exit); Maybe a comment here for those that missed the subtly in the commit message? /* cpu_loop_exec_tb updates a to a new last_tb */ > cpu_loop_exec_tb(cpu, tb, &last_tb, &tb_exit, &sc); You could even make it explicit and change cpu_loop_exec_tb to return last_tb instead of passing by reference. Then it would be even clearer when reading the code. > /* Try to align the host and virtual clocks > if the guest is in advance */ -- Alex Bennée