From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:37975) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5axn-0008Oi-NV for qemu-devel@nongnu.org; Mon, 19 Sep 2011 06:20:39 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5axj-0004L3-7a for qemu-devel@nongnu.org; Mon, 19 Sep 2011 06:20:35 -0400 Received: from mail-gx0-f173.google.com ([209.85.161.173]:57608) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5axj-0004Kt-53 for qemu-devel@nongnu.org; Mon, 19 Sep 2011 06:20:31 -0400 Received: by gxk26 with SMTP id 26so6035126gxk.4 for ; Mon, 19 Sep 2011 03:20:30 -0700 (PDT) MIME-Version: 1.0 In-Reply-To: References: <4E74FC29.1050003@mail.berlios.de> <4E760AB2.50007@mail.berlios.de> Date: Mon, 19 Sep 2011 11:20:30 +0100 Message-ID: From: Stefan Hajnoczi Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH 0/8] tcg/interpreter: Add TCG + interpreter for bytecode (virtual machine) List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: David Gilbert Cc: Mulyadi Santosa , QEMU Developers On Mon, Sep 19, 2011 at 9:40 AM, David Gilbert w= rote: > On 18 September 2011 16:13, Stefan Weil wrote: >> Am 18.09.2011 17:02, schrieb Mulyadi Santosa: >>> >>> Hi :) >>> >>> On Sun, Sep 18, 2011 at 02:59, Stefan Weil wrote= : >>>> >>>> Hello, >>>> >>>> these patches add a new code generator (TCG target) to qemu. >>> >>> I personally congrats you for your hard work. So, here's a question >>> from who are not so keen with Qemu internals: what is the biggest >>> advantage of using TCI instead of directly using TCG? >> >> TCG with native code support is much faster (6x to 10x), >> so for emulation on a supported host, TCI has no advantage >> for normal users. > > Is it possible to dynamically switch between the two? > > The two cases I'm thinking of are: > =A01) Using the interpreter to execute one or two instructions in an exce= ption > handling case > =A02) Avoiding TCG code generation on the first few runs of a piece of > code that might only be init code, and only bothering with TCG for hotter > code. The tricky thing with using the interpeter for lesser run code is that it has a bunch of machinery in front of it which probably makes it relatively similar to actually emitting native code. The interesting benchmark would be to translate blocks but never cache them for future executions - compare this with TCI to see how much difference there is between executing with interpretation vs translation. If the interpreter is almost as expensive as the translator then it's not worth it. Stefan