lua-users home
lua-l archive

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


Yes of course. I am used to using C in 32bit microcontrollers. If
there is any unaligned access in such parts, the microcontroller will
NOT do this "slower", but it will definitely crash with a "Hard memory
alignment" exception. ... Lua 5.4 is running very fine, no problem.
(Larger CPUs as e. g. Intel are often very generous/forgiving in such
cases to keep backward compatibility to older software... they then
just would "slow down" ... but full speed microcontrollers would crash
immediately... ).

... just this alignment issue is NOT critical for string access /
sequential byte flow access.

"Only" if you access numbers or pointers in C (short or long
variables... I am using a 32 bit ARM system).

... and it is quite clear, that the Lua stack is organized "string
type" / "sequential byte storage", anything else would be quite crazy
/ unusual. The same for the heap memory... .

If you load such "sequential byte data" into some 4byte / int
register, the compiler / software must do the following things: copy
it to an aligned memory, and ONLY then copy it to register... this is
"common work / common handling procedure" in such 32 bit software (or
also 64 bit software of course). This for sure Lua makes VERY
correctly... .