Hi Ian,
On Oct 21, 2006, at 6:23 PM, Ian Lynagh wrote:
Hi Peter,
On Sat, Oct 21, 2006 at 05:56:30PM -0400, Peter Tanski wrote:
Sorry for yet another typo:
#pragma options align=4
should have been:
#pragma options align=power
A definition might be:
#if powerpc_HOST_ARCH
#define ALIGN_POWER "#pragma options align=power"
#define ALIGN_POWER_RESET "#pragma options align=reset"
#else
#define ALIGN_POWER
#define ALIGN_POWER_RESET
#endif
I will try this out and see if the resulting code is any cleaner.
I can't find the context for this - is this a fix for something that's
broken, a performance improvement or something else? If it's a fix, do
you have an example that goes wrong?
Also, do you know if it is OS X specific, or if it would also apply to
PPC Linux?
Sorry for the out-of-context statement. You may not have read the
email I cc'd to [EMAIL PROTECTED], so I will send a copy of that
separately. In short, I had mentioned that Zero Length Array (ZLA)
members may require gnu extensions for support and only buy a
moderate amount of space and I suggested that using pragmas (at the
time I was thinking of packing the alignment) would save the same
amount of space, allow pointers to other structures to be used
instead of ZLA's and might even improve performance.
In this context, I had suggested the option for powerpc systems. It
would not be OS X specific and indeed it would only be a small
enhancement on OS X. An alignment pragma may save some space (on x86
processors which do not vary performance with alignment, as low as 1,
meaning 2^1) for structures and memory in general. On RISC
processors proper alignment may improve performance over what we have
now but I was wrong about the improvement #pragma options align=power
would make on all OS X systems.
After reading through the documentation on alignment again and some
assembler output code, it turns out the default alignment for Darwin
(OS X) 32-bit systems is the ABI alignment (which, in turn, defines
alignment for power systems): the alignment for a struct is
essentially the alignment of its largest member, though internally
the alignment of members after the first have an embedding alignment
of their natural size or at most 4 bytes (alignment of 2). Structs
containing doubles or long longs would improve with special pragmas,
but there aren't many of either in the RTS. In other words, no
improvement at all, except that it might--I have not deciphered the
assembler yet--help reduce packing extra space for ZLA members if the
ZLA's were packed to size 4 so they could contain the first member of
the next container. On 64-bit and powerpc-Linux systems the default
alignment given by gcc is 'natural,' which is the alignment of the
members of the structure (a structure may be aligned at 1, 2, 4, 8 or
16 bytes. So on x86 Windows packing the members of a struct (also
avaliable on Microsoft's CL compiler) would save some space and
alignment might make a difference on powerpc-Linux and other RISC
systems. Just an idea I had to try out. I hope none of this would
create more work for you.
Cheers,
Pete
_______________________________________________
Cvs-ghc mailing list
[EMAIL PROTECTED]
http://www.haskell.org/mailman/listinfo/cvs-ghc