From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([140.186.70.92]:43992) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5LZo-00068r-I7 for qemu-devel@nongnu.org; Sun, 18 Sep 2011 13:54:49 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1R5LZm-0003Tn-QB for qemu-devel@nongnu.org; Sun, 18 Sep 2011 13:54:48 -0400 Received: from mx1.redhat.com ([209.132.183.28]:14037) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1R5LZm-0003Th-I1 for qemu-devel@nongnu.org; Sun, 18 Sep 2011 13:54:46 -0400 Message-ID: <4E76305B.80108@redhat.com> Date: Sun, 18 Sep 2011 20:54:35 +0300 From: Avi Kivity MIME-Version: 1.0 References: <4E74FC29.1050003@mail.berlios.de> <1316289634-18786-5-git-send-email-weil@mail.berlios.de> <4E75865B.5040106@mail.berlios.de> <4E759C43.5070708@redhat.com> In-Reply-To: <4E759C43.5070708@redhat.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [Qemu-devel] [PATCH 5/8] tcg: Add interpreter for bytecode List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Paolo Bonzini Cc: Andi Kleen , QEMU Developers On 09/18/2011 10:22 AM, Paolo Bonzini wrote: > On 09/18/2011 07:49 AM, Stefan Weil wrote: >> Is there really any difference in the generated code? >> gcc already uses a jump table internally to handle the >> switch cases. > > You typically save something on range checks, and it enables a lot > more tricks for use later (e.g. using multiple jump tables to perform > simple peephole optimizations, or to divert code execution on > interrupts). I think it also improves branch target prediction - if you have a tight loop of a few opcodes the predictor can guess where you're headed (since there is a separate lookup key for each opcode), whereas with the original code, there's a single key which cannot be used to predict the branch target. -- error compiling committee.c: too many arguments to function