lua-users home
lua-l archive

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


On Sun, Sep 24, 2006 at 11:02:47PM -0500, Rici Lake wrote:
> Yeah, it's a pain. The best workaround is to use AMD chips instead of 
> Intel.
> (Next time you buy a computer :) ) -- I don't work for AMD or anything,
> but it was enough to convince me to change my purchasing preference.

That would be fine, if I only wrote programs to use myself.  :)

> If you don't mind using up a bunch of ram, you can force Lua objects to
> doubleword align. That will increase memory usage by up to one-third.
> There's a configuration option in luaconf.h which uses "double" as an
> alignment, but on x86, doubles are only 4-byte aligned so that doesn't
> help. You can add a double-word aligned object to the union (depends on
> your compiler how you do that.) You could also try making a lua number
> an extended double, if your compiler supports that; I haven't tried
> that but it should work on x86, where extended doubles are supposed
> to occupy 12 bytes, even though they only use 10. Alternatively, you
> can use floats, which reduces memory consumption, but it also loses
> a lot of precision, particularly for integers.

I tried __attribute__((aligned(16)) in various places around lua_TValue,
on lua_Number, and adding a dummy field to Value so TValue is 16 bytes,
but it didn't help.  Not sure what's wrong, I'm not familiar enough with
the code.

I'm also not sure if VC has an equivalent to attribute(aligned).

-- 
Glenn Maynard