lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]



On 16/01/2008, at 2:11 PM, alex.mania@iinet.net.au wrote:

This is on a completely unmodified lua core right?

Yup, I'm running a vanilla Lua 


If you're really stuck scratching your head, you could perform a quick sanity test of your
allocator by filling an array with mallocs, then freeing them all. (Obviously should not get
any errors by doing this).  If all the pointers are 8 or 16 byte aligned (easy to tell just
by running your eye over the debug window) aligned then your problem is that somehow
lua has ended up getting a 4 byte aligned pointer.

How I do not know =(.

-confused-


Thanks for the tips, I'll give that a shot. 

P.S. very quick and dirty explanation of data alignment:
The pointer remainder the size of what it is trying to store is 0 in an aligned pointer.
Eg if you're trying to store a 32 bit integer, the pointer should end in a: $0; $4; $8; $C;
Or a 64 bit double: $0, $8
Or a 128 bit SSE register: $0
Aligned data access is not required for integers or doubles on x86 (and -64), but will
increase performance. (Very very marginally for integers, but a large amount for doubles.)
For 128 bit SSE registers it's required whenever using memory as a second operand;
eg multiplying one SSE register by a memory location requires that memory location
to be 128 bit aligned, and is also required for fast loading of an SSE register (otherwise
the much slower movups command has to be used).


Thanks for the detailed reply, I'm still hunting for the problem and am still learning my way around C and Lua both and that sort of info is really helpful.

Cheers