From owner-svn-src-all@FreeBSD.ORG Tue Nov 4 09:28:15 2008 Return-Path: Delivered-To: svn-src-all@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 57F8D1065678 for ; Tue, 4 Nov 2008 09:28:15 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: from mail.gmx.net (mail.gmx.net [213.165.64.20]) by mx1.freebsd.org (Postfix) with SMTP id 980028FC2D for ; Tue, 4 Nov 2008 09:28:14 +0000 (UTC) (envelope-from christoph.mallon@gmx.de) Received: (qmail invoked by alias); 04 Nov 2008 09:28:12 -0000 Received: from p54A3EE10.dip.t-dialin.net (EHLO tron.homeunix.org) [84.163.238.16] by mail.gmx.net (mp026) with SMTP; 04 Nov 2008 10:28:12 +0100 X-Authenticated: #1673122 X-Provags-ID: V01U2FsdGVkX19JWL0Xe8pJtCPvxHfDyZMw2heMrtjKVgrvsH9u3P 3IWqkvYPhMW0n/ Message-ID: <491015AB.7070508@gmx.de> Date: Tue, 04 Nov 2008 10:28:11 +0100 From: Christoph Mallon User-Agent: Thunderbird 2.0.0.17 (X11/20080927) MIME-Version: 1.0 To: Joerg Sonnenberger References: <200811032209.mA3M9RhK077380@svn.freebsd.org> <490F800E.9080201@gmx.de> <20081103225453.GA1509@britannica.bec.de> In-Reply-To: <20081103225453.GA1509@britannica.bec.de> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Y-GMX-Trusted: 0 X-FuHaFi: 0.64 Cc: svn-src-all@freebsd.org Subject: Re: svn commit: r184605 - head/sys/dev/usb X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 04 Nov 2008 09:28:15 -0000 Joerg Sonnenberger wrote: > On Mon, Nov 03, 2008 at 11:49:50PM +0100, Christoph Mallon wrote: >> You may want to make cmd[] static and/or const, so the compiler really >> just puts the bytes in the data section instead of generating code, >> which pretty much is the same as the assignments you just removed. > > I didn't make it const originally as I am not sure if the USB stack will > never modify the buffer. GCC generates 31 movb instructions to initialise the array on entry of the function. Every movb is 5 Bytes long (opcode + mod r/m + sib + offset + immediate). 31 * 5 = 155 Bytes. It is only sensible to use static initialisation for a local array, which contains lots of zeroes, if it can be made static or const (GCC is clever enough to turn a const array into a static one). Yes, GCC could be more clever and use movl instead of movb, but it isn't. Christoph