-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
wasm-bindgen panics at local.tee instruction #2969
Comments
It looks like the WASI target is injecting some extra runtime stuff around the function (func $__wbindgen_describe___wbg_self_dc2f808420e70e36.command_export (type 1)
call $__wasm_call_ctors
call $__wbindgen_describe___wbg_self_dc2f808420e70e36
call $__wasm_call_dtors) |
Fixes rustwasm#2969 This changes `wasm-bindgen-wasm-interpreter` to ignore a function rather than panicking if it contains an unsupported instruction. This works around some runtime glue that gets added to our descriptor functions on the WASI target by more-or-less ignoring them. I also put some work into making sure a helpful error message is given if the actual describe function contains unsupported instructions, by keeping track of the instructions that caused us to skip and including them in the error message if the descriptor is invalid.
It seems I can trigger this without WASI:
Sorry, I don't have a minimal reproducer at this time, that's copy-pasted from a larger code base. I think I need a heap-allocated closure because it only gets used in the very next function call, which is async. My current workaround is to put both of those calls in a single async JS helper function, and then a stack-allocated closure works... |
This doesn't solve rustwasm#2969, since WASI uses plenty of instructions we don't support aside from `local.tee`, but it hopefully might solve [@tv42's issue](rustwasm#2969 (comment)).
This doesn't solve #2969, since WASI uses plenty of instructions we don't support aside from `local.tee`, but it hopefully might solve [@tv42's issue](#2969 (comment)).
Describe the Bug
When LocalTee is encountered, wasm-bindgen panics. This happens because this instruction is not handled proeprly. The panic occurs at
wasm-bindgen/crates/wasm-interpreter/src/lib.rs
Lines 354 to 363 in e447729
Unlike what the comment suggests, this also occurs in release mode
Steps to Reproduce
cargo build --target wasm32-wasi --release
wasm-bindgen target/wasm32-wasi/release/nushell-demo-2.wasm --out-dir dist
Backtrace
〉RUST_BACKTRACE=full wasm-bindgen target/wasm32-wasi/release/nushell-demo-2.wasm --out-dir dist
The text was updated successfully, but these errors were encountered: