diff options
author | Alon Zakai <alonzakai@gmail.com> | 2015-10-31 20:22:42 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2015-10-31 20:22:42 -0700 |
commit | cfb0cefcf93417a30c03bca7ff0a6c4d0428b1b5 (patch) | |
tree | c4dbaf88f84420d2c4f4c82b1b63c1437ccc8d38 | |
parent | 4f4a650c67d5105fedf44b83c06a51102947c045 (diff) | |
download | binaryen-cfb0cefcf93417a30c03bca7ff0a6c4d0428b1b5.tar.gz binaryen-cfb0cefcf93417a30c03bca7ff0a6c4d0428b1b5.tar.bz2 binaryen-cfb0cefcf93417a30c03bca7ff0a6c4d0428b1b5.zip |
debugging
-rwxr-xr-x | check.py | 8 | ||||
-rwxr-xr-x | emcc_to_polyfill.sh | 2 | ||||
-rw-r--r-- | src/wasm-js.cpp | 4 | ||||
-rw-r--r-- | test/add.emcc | 1 |
4 files changed, 12 insertions, 3 deletions
@@ -1,6 +1,6 @@ #!/usr/bin/env python -import os, sys, subprocess, difflib +import os, sys, subprocess, difflib, json interpreter = None tests = [] @@ -73,8 +73,12 @@ for c in tests: except: post = None expected = open(os.path.join('test', c.replace('.c', '.txt'))).read() + emcc = os.path.join('test', c.replace('.c', '.emcc')) + extra = [] + if os.path.exists(emcc): + extra = json.loads(open(emcc).read()) if os.path.exists('a.normal.js'): os.unlink('a.normal.js') - subprocess.check_call(['./emcc_to_polyfill.sh', os.path.join('test', c)], stdout=subprocess.PIPE, stderr=subprocess.PIPE) + subprocess.check_call(['./emcc_to_polyfill.sh', os.path.join('test', c)] + extra) if post: open('a.normal.js', 'a').write(post) open('a.wasm.js', 'a').write(post) diff --git a/emcc_to_polyfill.sh b/emcc_to_polyfill.sh index f806aa1dd..41337ae2d 100755 --- a/emcc_to_polyfill.sh +++ b/emcc_to_polyfill.sh @@ -3,7 +3,7 @@ set -e echo "calling emcc" -emcc $1 -o a.html --separate-asm -O2 -profiling -s DEMANGLE_SUPPORT=1 -s TOTAL_MEMORY=67108864 +emcc -o a.html --separate-asm -O2 -profiling -s DEMANGLE_SUPPORT=1 -s TOTAL_MEMORY=67108864 $@ # we now have a.asm.js and a.js diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp index bd92fb742..813ad87eb 100644 --- a/src/wasm-js.cpp +++ b/src/wasm-js.cpp @@ -58,6 +58,10 @@ extern "C" void EMSCRIPTEN_KEEPALIVE load_asm(char *input) { if (debug) std::cerr << "optimizing...\n"; asm2wasm.optimize(); +#ifdef WASM_INTERPRETER_DEBUG + std::cerr << *wasm << '\n'; +#endif + if (debug) std::cerr << "generating exports...\n"; EM_ASM({ Module['asmExports'] = {}; diff --git a/test/add.emcc b/test/add.emcc new file mode 100644 index 000000000..ff5a1f8b0 --- /dev/null +++ b/test/add.emcc @@ -0,0 +1 @@ +["-s", "EXPORTED_FUNCTIONS=[\"_add\"]"] |