diff options
-rw-r--r-- | README.md | 6 | ||||
-rwxr-xr-x | build.sh | 4 | ||||
-rwxr-xr-x | emcc_to_polyfill.sh | 2 |
3 files changed, 4 insertions, 8 deletions
@@ -13,9 +13,7 @@ More specifically, this repository contains: $ ./build.sh ``` -This requires a C++11 compiler. - -Note: you might want to add `-O2` or such. +`asm2wasm` requires a C++11 compiler. `wasm.js` requires Emscripten (which you can [get here](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html)). ## Running @@ -63,8 +61,6 @@ Run 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). -You will need `emcc`, so you should [grab Emscripten](http://kripken.github.io/emscripten-site/docs/getting_started/downloads.html). - ### C/C++ Source => asm2wasm Using emcc you can generate asm.js files for direct parsing by `asm2wasm` on the commandline, for example using @@ -1,6 +1,6 @@ echo "building asm2wasm" -g++ -std=c++11 src/asm2wasm-main.cpp src/parser.cpp src/simple_ast.cpp src/optimizer-shared.cpp -g -o bin/asm2wasm +g++ -O2 -std=c++11 src/asm2wasm-main.cpp src/parser.cpp src/simple_ast.cpp src/optimizer-shared.cpp -g -o bin/asm2wasm echo "building interpreter/js" -em++ -std=c++11 src/wasm-js.cpp src/parser.cpp src/simple_ast.cpp src/optimizer-shared.cpp -o bin/wasm.js -s MODULARIZE=1 -s 'EXPORT_NAME="WasmJS"' --memory-init-file 0 -s DEMANGLE_SUPPORT=1 -O2 -profiling -s TOTAL_MEMORY=67108864 #-DWASM_INTERPRETER_DEBUG +em++ -std=c++11 src/wasm-js.cpp src/parser.cpp src/simple_ast.cpp src/optimizer-shared.cpp -o bin/wasm.js -s MODULARIZE=1 -s 'EXPORT_NAME="WasmJS"' --memory-init-file 0 -s DEMANGLE_SUPPORT=1 -O3 -profiling -s TOTAL_MEMORY=67108864 #-DWASM_INTERPRETER_DEBUG cat src/js/post.js >> bin/wasm.js diff --git a/emcc_to_polyfill.sh b/emcc_to_polyfill.sh index 41337ae2d..fd2dd7791 100755 --- a/emcc_to_polyfill.sh +++ b/emcc_to_polyfill.sh @@ -3,7 +3,7 @@ set -e echo "calling emcc" -emcc -o a.html --separate-asm -O2 -profiling -s DEMANGLE_SUPPORT=1 -s TOTAL_MEMORY=67108864 $@ +emcc -o a.html --separate-asm -O3 -profiling -s DEMANGLE_SUPPORT=1 -s TOTAL_MEMORY=67108864 $@ # we now have a.asm.js and a.js |