alignment on powerpc

Chris Pickett <[email protected]> Tue, 02 May 2006 22:55:58 -0400
Newsgroups gmane.comp.java.vm.sablevm.devel
Message-ID <[email protected]>
Hi,

[I haven't looked at the prepare_code.c data race stuff yet.]

If I run the (slightly modified) program following this message from 
libsablevm/system.h on a 32-bit iBook under Mac OS X with gcc 3.3, I get 
"alignment = 4" printed out.  Yet we have

#define SVM_ALIGNMENT 8
#define SVM_ALIGNMENT_POWER 3

defined in the __powerpc__ section of system.h.

Why is alignment defined like this?  Also, perhaps there need to be 
separate ports for 32-bit and 64-bit PowerPC processors, since the word 
size is very likely 8 on a 64-bit arch and not 4.

Cheers,
Chris

#include <stdio.h>

struct {
   char c;
   int v;
} a;

int
main (int argc, char *argv[])
{
   printf ("alignment = %u\n",
           (unsigned int) (((char *) &a.v) - ((char *) &a)));
   return 0;
}