summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-11 19:34:25 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-11 19:34:25 -0800
commited6621625b2e4c058866d31a6bf56c68e3a87c95 (patch)
tree5f24b6fa030faff181bf0069e89ee99dc091f8d0
parent9349a87c141540a028633dc50a5b680f3afb2e99 (diff)
downloadbinaryen-ed6621625b2e4c058866d31a6bf56c68e3a87c95.tar.gz
binaryen-ed6621625b2e4c058866d31a6bf56c68e3a87c95.tar.bz2
binaryen-ed6621625b2e4c058866d31a6bf56c68e3a87c95.zip
readme updates
-rw-r--r--README.md18
1 files changed, 10 insertions, 8 deletions
diff --git a/README.md b/README.md
index 03c9f0243..9187ec23d 100644
--- a/README.md
+++ b/README.md
@@ -17,6 +17,8 @@ This repository contains code that builds the following tools in `bin/`:
* **asm2wasm**: An asm.js-to-WebAssembly compiler, built on Emscripten's asm optimizer infrastructure. That can directly compile asm.js to WebAssembly.
* **wasm.js**: A polyfill for WebAssembly support in browsers. It receives an asm.js module, parses it using an internal build of `asm2wasm`, and runs the resulting WebAssembly in a WebAssembly interpreter. It provides what looks like an asm.js module, while running WebAssembly inside.
+Usage instructions for each are below.
+
## Building
```
@@ -34,14 +36,15 @@ $ ./build.sh
Run
````
-bin/binaryen-shell file.wast [print AST before running]
+bin/binaryen-shell [.wast file] [--print-before]
````
+ * `--print-before` will print the module before running it.
* Setting `BINARYEN_DEBUG=1` in the env will emit a lot of debugging info.
### asm2wasm
-Just run
+run
```
bin/asm2wasm [input.asm.js file]
@@ -78,7 +81,7 @@ Set `ASM2WASM_DEBUG=1` in the env to see debug info, about asm.js functions as t
Run
```
-./emcc_to_wasm.js.sh [filename.c ; whatever other emcc flags you want]
+./emcc_to_wasm.js.sh [.c or .cpp file] [whatever other emcc flags you want]
```
That will call `emcc` and then emit `a.normal.js`, a normal asm.js build for comparison purposes, and `a.wasm.js`, which contains the entire polyfill (`asm2wasm` translator + `wasm.js` interpreter).
@@ -93,7 +96,7 @@ emcc src.cpp -o a.html --separate-asm
That will emit `a.html`, `a.js`, and `a.asm.js`. That last file is the asm.js module, which you can pass into `asm2wasm`.
-For basic tests, that command should work, but in general you need a few more arguments to emcc, see emcc's usage in `emcc_to_wasm.js.sh`, specifically
+For basic tests, that command should work, but in general you need a few more arguments to emcc, see emcc's usage in `emcc_to_wasm.js.sh`, specifically:
* `ALIASING_FUNCTION_POINTERS=0` because WebAssembly does not allow aliased function pointers (there is a single table).
* `GLOBAL_BASE=1000` because WebAssembly lacks global variables, so `asm2wasm` maps them onto addresses in memory. This requires that you have some reserved space for those variables. With that argument, we reserve the area up to `1000`.
@@ -104,7 +107,7 @@ For basic tests, that command should work, but in general you need a few more ar
./check.py
```
-(or `python check.py`) will run `asm2wasm` and `wasm.js` on the testcases in `test/`, and verify their outputs.
+(or `python check.py`) will run `binaryen-shell`, `asm2wasm`, and `wasm.js` on the testcases in `test/`, and verify their outputs.
The `check.py` script supports some options:
@@ -118,8 +121,8 @@ The `check.py` script supports some options:
## FAQ
- * How does this relate to the new WebAssembly backend which is being developed in upstream LLVM?
- * This is separate from that. This project focuses on compiling asm.js to WebAssembly, as emitted by Emscripten's asm.js backend. This is useful because while in the long term Emscripten hopes to use the new WebAssembly backend, the `asm2wasm` route is a very quick and easy way to generate WebAssembly output. It will also be useful for benchmarking the new backend as it progresses.
+ * How does `asm2wasm` relate to the new WebAssembly backend which is being developed in upstream LLVM?
+ * This is separate from that. `asm2wasm` focuses on compiling asm.js to WebAssembly, as emitted by Emscripten's asm.js backend. This is useful because while in the long term Emscripten hopes to use the new WebAssembly backend, the `asm2wasm` route is a very quick and easy way to generate WebAssembly output. It will also be useful for benchmarking the new backend as it progresses.
## License & Contributing
@@ -129,7 +132,6 @@ Same as Emscripten: MIT license.
## TODO
- * Waiting for switch to stablize on the spec repo; switches are Nop'ed.
* Reference interpreter lacks module importing support; imports are Nop'ed in native builds, but enabled in emcc builds (so wasm.js works).
* Memory section needs the right size.