Subject: Re: one program, one machine, two wildly different execution times
To: None <jbernard@mines.edu>
From: Ben Harris <bjh21@netbsd.org>
List: current-users
Date: 04/21/2003 12:57:47
In article <20030420180434.GA13151@zoo.bernard.org> you write:
>  I have tracked down a couple of tidbits that may relate to the problem:
>
>This one, from a beowulf list in 1998:
>
>  http://www.beowulf.org/pipermail/beowulf/1998-June/000831.html
>
>describes a similar observation with some C code compiled with egcs on a
>PII.  The poster eventually tracked it down to a dependence on the alignment
>of the stack pointer on entry, which apparently was not always the same.

That sounds entirely plausible.  NetBSD puts the environment on the top of
the user stack, and its size can be affected by all sorts of things.  You
could try running the program with a cleaned environment using "env -i" and
see if that makes it behave consistently.  Alternatively, you could try
printing __builtin_frame_address(0) and seeing if that offers any clues.

It looks like GCC on i386 tries to keep the stack aligned on a 16-byte
boundary, but that only works if the stack starts out aligned that way.  I
don't know if NetBSD/i386 aligns the stack particularly.  I think NetBSD/arm
does, because the perpetually-forthcoming EABI requires it.

-- 
Ben Harris                                                   <bjh21@netbsd.org>
Portmaster, NetBSD/acorn26           <URL:http://www.netbsd.org/Ports/acorn26/>