From owner-cvs-all Mon Feb 24 11:58:21 2003 Delivered-To: cvs-all@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 6FDCC37B401; Mon, 24 Feb 2003 11:58:18 -0800 (PST) Received: from ns1.xcllnt.net (209-128-86-226.BAYAREA.NET [209.128.86.226]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6C7B943F3F; Mon, 24 Feb 2003 11:58:17 -0800 (PST) (envelope-from marcel@xcllnt.net) Received: from athlon.pn.xcllnt.net (athlon.pn.xcllnt.net [192.168.4.3]) by ns1.xcllnt.net (8.12.6/8.12.6) with ESMTP id h1OJwG1o043559; Mon, 24 Feb 2003 11:58:17 -0800 (PST) (envelope-from marcel@piii.pn.xcllnt.net) Received: from athlon.pn.xcllnt.net (localhost [127.0.0.1]) by athlon.pn.xcllnt.net (8.12.7/8.12.7) with ESMTP id h1OJwGWk000696; Mon, 24 Feb 2003 11:58:16 -0800 (PST) (envelope-from marcel@athlon.pn.xcllnt.net) Received: (from marcel@localhost) by athlon.pn.xcllnt.net (8.12.7/8.12.7/Submit) id h1OJwG6d000695; Mon, 24 Feb 2003 11:58:16 -0800 (PST) (envelope-from marcel) Date: Mon, 24 Feb 2003 11:58:16 -0800 From: Marcel Moolenaar To: Bruce Evans Cc: src-committers@FreeBSD.org, cvs-src@FreeBSD.org, cvs-all@FreeBSD.org Subject: Re: cvs commit: src/bin/sh machdep.h memalloc.c nodes.c.pat Message-ID: <20030224195816.GA661@athlon.pn.xcllnt.net> References: <200302240807.h1O875e2058863@repoman.freebsd.org> <20030224214010.I6444-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20030224214010.I6444-100000@gamplex.bde.org> User-Agent: Mutt/1.5.3i Sender: owner-cvs-all@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Mon, Feb 24, 2003 at 09:53:49PM +1100, Bruce Evans wrote: > > You could align the statically allocated stack (struct) using the standard > hack of putting a field that needs strictest alignment in it: > > struct stack_block { > struct stack_block *prev; > aligned_t space; > char morespace[MINSIZE - sizeof(aligned_t)]; > }; > > where [_]aligned_t is defined by MD magic (involving the aligned attribute in > the gcc case) near the definition of [_]ALIGN(). > > `morespace' may have the wrong size here (it may be affected by unnamed > padding before `space'...) but it has a bogus Ultrixified value anyway). > 512 for the whole struct might be better. Hmmm.... Allowing sizeof(aligned_t) will yield a magic type that takes up space, which if it also has the right alignment will generally cause field morespace to have an offset > ALIGN from the start of the struct. In the common case (already 16-byte aligned due to malloc(3) for all but the static stack_block) wastes 16-bytes per stack_block. Not something to panic about, but a downside. The solution also depends on FreeBSD specific machine-dependent and compiler dependent trickery, which is less portable than the current solution. There many not even be a C type that has the size required (other than compound types). The long double type may be 16-bytes I guess... I've been thinking about bumping up the size of the allocation to 1024. I lack statistics to back me up. -- Marcel Moolenaar USPA: A-39004 marcel@xcllnt.net To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe cvs-all" in the body of the message