Samsung / walrus

WebAssembly Lightweight RUntime
Apache License 2.0
39 stars 10 forks source link

Align memory to pointer size. #175

Closed GorogPeter closed 12 months ago

GorogPeter commented 1 year ago

Some architectures like ARM32 doesn't support non-aligned memory operations thus I aligned the memory.

Without it Walrus crashes on ARM32.

zherczeg commented 1 year ago

A bit more background: ARM32 just partly support unaligned access. For example all floats/doubles must be 4 byte aligned, and some integer operations such as load/store multiple must be as well. For example, when a 64 bit integer is loaded with load multiple instruction, it must be 4 byte aligned. The byte code is not aligned, but aligning it to pointer size fixes this. The other alternative is use attribute packed on the ByteCode structure. That is just a single line change, but the generated code is less efficient. What do you think?