From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Lac81-0000om-0Z for qemu-devel@nongnu.org; Fri, 20 Feb 2009 15:37:45 -0500 Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Lac7z-0000ny-7A for qemu-devel@nongnu.org; Fri, 20 Feb 2009 15:37:44 -0500 Received: from [199.232.76.173] (port=48026 helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Lac7y-0000nn-R8 for qemu-devel@nongnu.org; Fri, 20 Feb 2009 15:37:42 -0500 Received: from pop-cowbird.atl.sa.earthlink.net ([207.69.195.68]:39671) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Lac7y-0007Tq-Db for qemu-devel@nongnu.org; Fri, 20 Feb 2009 15:37:42 -0500 Received: from user-142h2k8.cable.mindspring.com ([72.40.138.136] helo=[192.168.0.90]) by pop-cowbird.atl.sa.earthlink.net with esmtp (Exim 3.36 #1) id 1Lac7v-0000OC-00 for qemu-devel@nongnu.org; Fri, 20 Feb 2009 15:37:39 -0500 Message-ID: <499F1492.5080602@earthlink.net> Date: Fri, 20 Feb 2009 15:37:38 -0500 From: Robert Reif MIME-Version: 1.0 Subject: Re: [Qemu-devel] [PATCH] exec.c remove unnecessary operators on functions References: <499EF249.4000005@earthlink.net> In-Reply-To: <499EF249.4000005@earthlink.net> Content-Type: multipart/mixed; boundary="------------010802000807040604050303" Reply-To: qemu-devel@nongnu.org List-Id: qemu-devel.nongnu.org List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org This is a multi-part message in MIME format. --------------010802000807040604050303 Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit Robert Reif wrote: > > Also, why is it necessary to take the address of a variable holding a > function address rather than saving the function address directly > in exec.c lines 2766 and 2771? > > This removes the extra level of indirection. Comments? --------------010802000807040604050303 Content-Type: text/plain; name="subpage.diff.txt" Content-Transfer-Encoding: 7bit Content-Disposition: inline; filename="subpage.diff.txt" --- exec.c (revision 6629) +++ exec.c (working copy) @@ -197,8 +197,8 @@ #define SUBPAGE_IDX(addr) ((addr) & ~TARGET_PAGE_MASK) typedef struct subpage_t { target_phys_addr_t base; - CPUReadMemoryFunc **mem_read[TARGET_PAGE_SIZE][4]; - CPUWriteMemoryFunc **mem_write[TARGET_PAGE_SIZE][4]; + CPUReadMemoryFunc *mem_read[TARGET_PAGE_SIZE][4]; + CPUWriteMemoryFunc *mem_write[TARGET_PAGE_SIZE][4]; void *opaque[TARGET_PAGE_SIZE][2][4]; ram_addr_t region_offset[TARGET_PAGE_SIZE][2][4]; } subpage_t; @@ -2658,7 +2658,7 @@ printf("%s: subpage %p len %d addr " TARGET_FMT_plx " idx %d\n", __func__, mmio, len, addr, idx); #endif - ret = (**mmio->mem_read[idx][len])(mmio->opaque[idx][0][len], + ret = mmio->mem_read[idx][len](mmio->opaque[idx][0][len], addr + mmio->region_offset[idx][0][len]); return ret; @@ -2674,7 +2674,7 @@ printf("%s: subpage %p len %d addr " TARGET_FMT_plx " idx %d value %08x\n", __func__, mmio, len, addr, idx, value); #endif - (**mmio->mem_write[idx][len])(mmio->opaque[idx][1][len], + mmio->mem_write[idx][len](mmio->opaque[idx][1][len], addr + mmio->region_offset[idx][1][len], value); } @@ -2733,16 +2733,16 @@ subpage_writelen(opaque, addr, value, 2); } -static CPUReadMemoryFunc *subpage_read[] = { - &subpage_readb, - &subpage_readw, - &subpage_readl, +static CPUReadMemoryFunc *subpage_read[3] = { + subpage_readb, + subpage_readw, + subpage_readl, }; -static CPUWriteMemoryFunc *subpage_write[] = { - &subpage_writeb, - &subpage_writew, - &subpage_writel, +static CPUWriteMemoryFunc *subpage_write[3] = { + subpage_writeb, + subpage_writew, + subpage_writel, }; static int subpage_register (subpage_t *mmio, uint32_t start, uint32_t end, @@ -2763,12 +2763,12 @@ for (; idx <= eidx; idx++) { for (i = 0; i < 4; i++) { if (io_mem_read[memory][i]) { - mmio->mem_read[idx][i] = &io_mem_read[memory][i]; + mmio->mem_read[idx][i] = io_mem_read[memory][i]; mmio->opaque[idx][0][i] = io_mem_opaque[memory]; mmio->region_offset[idx][0][i] = region_offset; } if (io_mem_write[memory][i]) { - mmio->mem_write[idx][i] = &io_mem_write[memory][i]; + mmio->mem_write[idx][i] = io_mem_write[memory][i]; mmio->opaque[idx][1][i] = io_mem_opaque[memory]; mmio->region_offset[idx][1][i] = region_offset; } --------------010802000807040604050303--