Re: Unaligned memory access

Roberto Ierusalimschy <[email protected]>
Newsgroups gmane.comp.lang.lua.general
Message-ID <[email protected]>
> However, I have alignment issues in the userdata from time to time. It
> happens when the userdata contains something that requires a 16 byte
> alignment. Since this is not enforced by lua_newuserdata, the program will
> crash with things like this:
> 
>    0x00007ff6fe911135 <+85>:    xorps  %xmm6,%xmm6
> => 0x00007ff6fe911138 <+88>:    movaps %xmm6,0x50(%rdi)
> 
> where %rdi is not 16-bytes aligned.

Lua ensures that the memory in a userdata is aligned with values
in ISO C. If you have other objects that require other alignments
(such as 16-bit values), you can redefine the macro LUAI_MAXALIGN, in
luaconf.h. Its standard definition is like this:

  #define LUAI_MAXALIGN  lua_Number n; double u; void *s; lua_Integer i; long l

Just toss these other objects in this list.

-- Roberto

-- 
You received this message because you are subscribed to the Google Groups "lua-l" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [email protected].
To view this discussion visit https://groups.google.com/d/msgid/lua-l/20260214173929.GB166012%40arraial.inf.puc-rio.br.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.