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
Rename wasm2asm to wasm2js, emit ESM by default (#1642)
* Rename the `wasm2asm` tool to `wasm2js`
This commit performs a relatively simple rename of the `wasm2asm` tool to
`wasm2js`. The functionality of the tool doesn't change just yet but it's
intended that we'll start generating an ES module instead of just an `asm.js`
function soon.
* wasm2js: Support `*.wasm` input files
Previously `wasm2js` only supported `*.wast` files but to make it a bit easier
to use in tooling pipelines this commit adds support for reading in a `*.wasm`
file directly. Determining which parser to use depends on the input filename,
where the binary parser is used with `*.wasm` files and the wast parser is used
for all other files.
* wasm2js: Emit ESM imports/exports by default
This commit alters the default behavior of `wasm2js` to emit an ESM by default,
either importing items from the environment or exporting. Items like
initialization of memory are also handled here.
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,7 +12,7 @@ Compilers built using Binaryen include
12
12
13
13
*[`asm2wasm`](https://github.com/WebAssembly/binaryen/blob/master/src/asm2wasm.h) which compiles asm.js to WebAssembly
14
14
*[`AssemblyScript`](https://github.com/AssemblyScript/assemblyscript) which compiles TypeScript to Binaryen IR
15
-
*[`wasm2asm`](https://github.com/WebAssembly/binaryen/blob/master/src/wasm2asm.h) which compiles WebAssembly to asm.js
15
+
*[`wasm2js`](https://github.com/WebAssembly/binaryen/blob/master/src/wasm2js.h) which compiles WebAssembly to JS
16
16
*[`Asterius`](https://github.com/tweag/asterius) which compiles Haskell to WebAssembly
17
17
18
18
Binaryen also provides a set of **toolchain utilities** that can
@@ -64,7 +64,7 @@ This repository contains code that builds the following tools in `bin/`:
64
64
***wasm-dis**: Un-assembles WebAssembly in binary format into text format (going through Binaryen IR).
65
65
***wasm-opt**: Loads WebAssembly and runs Binaryen IR passes on it.
66
66
***asm2wasm**: An asm.js-to-WebAssembly compiler, using Emscripten's asm optimizer infrastructure. This is used by Emscripten in Binaryen mode when it uses Emscripten's fastcomp asm.js backend.
67
-
***wasm2asm**: A WebAssembly-to-asm.js compiler (still experimental).
67
+
***wasm2js**: A WebAssembly-to-JS compiler (still experimental).
68
68
***wasm-merge**: Combines wasm files into a single big wasm file (without sophisticated linking).
69
69
***wasm-ctor-eval**: A tool that can execute C++ global constructors ahead of time. Used by Emscripten.
70
70
***wasm-emscripten-finalize**: Takes a wasm binary produced by llvm+lld and performs emscripten-specific passes over it.
@@ -212,11 +212,11 @@ This is separate from that. `asm2wasm` focuses on compiling asm.js to WebAssembl
212
212
213
213
* How about compiling WebAssembly to asm.js (the opposite direction of `asm2wasm`)? Wouldn't that be useful for polyfilling?
214
214
215
-
Experimentation with this is happening, in `wasm2asm`.
215
+
Experimentation with this is happening, in `wasm2js`.
216
216
217
217
This would be useful, but it is a much harder task, due to some decisions made in WebAssembly. For example, WebAssembly can have control flow nested inside expressions, which can't directly map to asm.js. It could be supported by outlining the code to another function, or to compiling it down into new basic blocks and control-flow-free instructions, but it is hard to do so in a way that is both fast to do and emits code that is fast to execute. On the other hand, compiling asm.js to WebAssembly is almost straightforward.
218
218
219
-
We just have to do more work on `wasm2asm` and see how efficient we can make it.
219
+
We just have to do more work on `wasm2js` and see how efficient we can make it.
0 commit comments