Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 24 Feb 2003 11:58:16 -0800
From:      Marcel Moolenaar <marcel@xcllnt.net>
To:        Bruce Evans <bde@zeta.org.au>
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>
In-Reply-To: <20030224214010.I6444-100000@gamplex.bde.org>
References:  <200302240807.h1O875e2058863@repoman.freebsd.org> <20030224214010.I6444-100000@gamplex.bde.org>

next in thread | previous in thread | raw e-mail | index | archive | help
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




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030224195816.GA661>