diff options
author | Alon Zakai <alonzakai@gmail.com> | 2019-04-19 15:22:55 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-04-19 15:22:55 -0700 |
commit | db14d0477f2715e3071687f42b77d8712477d83e (patch) | |
tree | 7cb4f679bfc18cbb7d4a87db0b3d5a02f6bcaeed /src/wasm2js.h | |
parent | a4baf2152d11c28964025759d2702fe7c48d321e (diff) | |
download | binaryen-db14d0477f2715e3071687f42b77d8712477d83e.tar.gz binaryen-db14d0477f2715e3071687f42b77d8712477d83e.tar.bz2 binaryen-db14d0477f2715e3071687f42b77d8712477d83e.zip |
wasm2js2 import fixes (#2031)
* Don't assume function types exist in legalize-js-interface.
* Properly handle (ignore) imports in RemoveNonJSOps - do not try to recurse into them.
* Run legalize-js-interface and remove-unused-module-elements in wasm2js, the first is necessary, the last is nice to have.
Diffstat (limited to 'src/wasm2js.h')
-rw-r--r-- | src/wasm2js.h | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/wasm2js.h b/src/wasm2js.h index 34471e213..faad6c3fa 100644 --- a/src/wasm2js.h +++ b/src/wasm2js.h @@ -290,6 +290,7 @@ private: Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) { PassRunner runner(wasm); runner.add<AutoDrop>(); + runner.add("legalize-js-interface"); // First up remove as many non-JS operations we can, including things like // 64-bit integer multiplication/division, `f32.nearest` instructions, etc. // This may inject intrinsics which use i64 so it needs to be run before the @@ -303,6 +304,7 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) { runner.add("simplify-locals-notee-nostructure"); runner.add("reorder-locals"); runner.add("vacuum"); + runner.add("remove-unused-module-elements"); runner.setDebug(flags.debug); runner.run(); @@ -311,7 +313,7 @@ Ref Wasm2JSBuilder::processWasm(Module* wasm, Name funcName) { #ifndef NDEBUG if (!WasmValidator().validate(*wasm)) { WasmPrinter::printModule(wasm); - Fatal() << "error in validating input"; + Fatal() << "error in validating wasm2js output"; } #endif |