You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When converting a WebAssembly module using wasm2js, I encountered an error related to the features section of the module. The module includes advanced WebAssembly features such as mutable-globals, bulk-memory, and sign-ext. Despite attempts to optimize or strip these features using wasm-opt, the error persists.
The error message is as follows:
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, bulk-memory-opt Fatal: error in validating wasm2js output
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, bulk-memory-opt in after use wasm-dis in file
Steps to Reproduce
Use the following WebAssembly file (or a similar file with advanced features):
Run the following commands:```bash
wasm-opt input.wasm --strip-debug --strip-producers --disable-mutable-globals --disable-bulk-memory -o optimized.wasm -O2
wasm2js optimized.wasm -o output.js
3.Observe the error related to the features section.
Actual Behavior
The conversion process fails with a validation error, even after attempting to strip or disable advanced WebAssembly features using wasm-opt.
Stripping debug and producer sections using wasm-opt.
Disabling specific features like mutable-globals and bulk-memory during optimization.
Re-generating the WebAssembly file with minimal features.
The issue persists even when using the latest version of Binaryen.
Suggested Improvement
Enhance wasm2js to either skip unsupported features or convert as much as possible while issuing warnings.
Provide better documentation or guidance for handling advanced WebAssembly features in wasm2js.
The text was updated successfully, but these errors were encountered:
I have attempted the following solutions: Re-generating the WebAssembly file with minimal features.
That should work. If it does not then something else is going on rather than features. Make sure that you are emitting a wasm file without those features.
In general, wasm2js is meant to support very old browsers and runtimes, places without wasm. Those places will not benefit from newer wasm features like sign-ext, so wasm2js does not support them.
Note that there are some lowering passes you can run before wasm2js, that can help in some cases: --llvm-memory-copy-fill-lowering, --llvm-nontrapping-fptoint-lowering, --signext-lowering, but they have limitations. It is best to just not emit the features, if you will be running wasm2js.
When converting a WebAssembly module using
wasm2js
, I encountered an error related to the features section of the module. The module includes advanced WebAssembly features such asmutable-globals
,bulk-memory
, andsign-ext
. Despite attempts to optimize or strip these features usingwasm-opt
, the error persists.The error message is as follows:
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, bulk-memory-opt Fatal: error in validating wasm2js output
;; features section: mutable-globals, nontrapping-float-to-int, bulk-memory, sign-ext, bulk-memory-opt
in after use wasm-dis in fileSteps to Reproduce
Use the following WebAssembly file (or a similar file with advanced features):
Run the following commands:```bash
wasm-opt input.wasm --strip-debug --strip-producers --disable-mutable-globals --disable-bulk-memory -o optimized.wasm -O2
wasm2js optimized.wasm -o output.js
3.Observe the error related to the features section.
Actual Behavior
The conversion process fails with a validation error, even after attempting to strip or disable advanced WebAssembly features using wasm-opt.
Environment
Tool version: Binaryen 121
Command line used: wasm2js, wasm-opt
OS: win11
Additional Context
I have attempted the following solutions:
Stripping debug and producer sections using wasm-opt.
Disabling specific features like mutable-globals and bulk-memory during optimization.
Re-generating the WebAssembly file with minimal features.
The issue persists even when using the latest version of Binaryen.
Suggested Improvement
Enhance wasm2js to either skip unsupported features or convert as much as possible while issuing warnings.
Provide better documentation or guidance for handling advanced WebAssembly features in wasm2js.
The text was updated successfully, but these errors were encountered: