WebAssembly / binaryen

Optimizer and compiler/toolchain library for WebAssembly
Apache License 2.0
7.28k stars 716 forks source link

wasm2js: unhandled unaligned store, UNREACHABLE executed at, Aborted #5688

Open regnaio opened 1 year ago

regnaio commented 1 year ago

Trying to run wasm2js on HavokPhysics.wasm in https://github.com/BabylonJS/Babylon.js/tree/master/packages/tools/babylonServer/public/havok

Getting the error:

./wasm2js ../../../Babylon.js/packages/tools/babylonServer/public/havok/HavokPhysics.wasm -o ../../../Babylon.js/packages/tools/babylonServer/public/havok/HavokPhysics.js

unhandled unaligned store
UNREACHABLE executed at /src/src/passes/AlignmentLowering.cpp:334!
Aborted

Using version: https://github.com/WebAssembly/binaryen/releases/tag/version_112 Linux: binaryen-version_112-x86_64-linux.tar.gz

kripken commented 1 year ago

Looks like the basic types are handled in that switch, so what is likely the problem is that there is an unaligned v128 store, that the pass would need to be updated to handle.

Pokeplays09125 commented 2 months ago

I'm sorry, but I'm having the same issue. I'm just new to using Linux, so I have no idea what kripken is talking about, so if he is talking about how to fix it, I can't tell. Can someone please dumb it down for me?

tlively commented 2 months ago

To fix the problem, we need to write more code in src/passes/AlignmentLowering.cpp around line 334. That code needs to break stores of 16-byte values into multiple stores of 1 byte each.