On Mon, 13 Jun 2005, Leopold Toetsch via RT wrote: > Chip Salzenberg wrote: > > On Mon, Jun 13, 2005 at 07:12:48PM +0200, Leopold Toetsch wrote: > > > >>Andy Dougherty (via RT) wrote: > >> > >>>... On SPARC, doubles should be aligned on 8-bit boundaries. > >>>The speculation is that the _num_val part of the UnionVal in the PMC > >>>ends up unaligned. However, I couldn't follow where that happened, so I > >>>can't suggest a patch. > >> > >>It happends directly in the PMC memory arena. Whenever the PMC size % 8 > >>isn't zero.
Yes, I saw this bit in include/parrot/pobj.h: /* Parrot Object - base class for all others */ typedef struct pobj_t { UnionVal u; Parrot_UInt flags; #if ! DISABLE_GC_DEBUG UINTVAL _pobj_version; #endif /* ! DISABLE_GC_DEBUG */ } pobj_t; In an optimized compile, sizeof(pobj_t) is 16, and sizeof(PMC) is 24, both of which are nice multiples of 8. > > That's gotta be a compiler bug. When a structure contains a member > > that needs N-byte alignment, and sizeof(structure) % N is not zero, > > the compiler is busted. (Have they never heard of _arrays_?) > > The PMC allocation area is a big bunch of memory, where PMC-sized pieces > are carved out by the memory allocation system. There is no union or > compiler bug involved. It's caused by the memory allocator and the GC > system. That's what I couldn't follow. Where are PMC-sized pieces carved out that aren't carved out using sizeof(PMC)? -- Andy Dougherty [EMAIL PROTECTED]