On Sat, Sep 01, 2012 at 09:05:10PM +0100, Dave Mitchell wrote: > > > > OK, thanks. I don't know any x86_64 assembler, nor do I know its alignment > > constrains or whatnot, so I'm not able to work out from this what went > > wrong. And whether it's us doing something dodgy or them. > > See http://www.damtp.cam.ac.uk/cosmos/private/documentation/vtune/users_guide/mergedProjects/analyzer_ec/mergedProjects/reference_olh/instruct32_hh/vc181.htm > > (fond from google search). > > movaps basically copies a 16-byte check to/from one of FPU registers; the > data must be 16-byte aligned. From ther above, sv_any is only 8-byte > alignegned > > On my Linux system, the line > StructCopy(SvANY(sv), xpvmg, XPVMG); > is expanded to > (*((XPVMG*)(xpvmg)) = *((XPVMG*)((sv)->sv_any))); > > So, struct xpvgv's are being allocated on 8-byte boundaries within the arena, > yet the compiler assumes the structure is 16-byte aligned. After that I get > confused. > > PS the structure (xpvmg and xpvgv) expand as > > ptr > ptr/STRLEN > STRLEN/I32 > ptr/IV/UV > NV/ptr/{U32,U32}/{I32,U8} > > where the / show different elements of a union The code is built with usemorebits, hence uselongdouble, so the NV element would force 16-byte alignment. So the compiler is correct to assume 16-byte alignment (assuming I remember the x64 ABI correctly). Tony