summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xbuild.sh2
-rwxr-xr-xcheck.py14
-rw-r--r--src/wasm-interpreter.h4
-rw-r--r--src/wasm-js.cpp4
4 files changed, 12 insertions, 12 deletions
diff --git a/build.sh b/build.sh
index a011c4595..53eaeece6 100755
--- a/build.sh
+++ b/build.sh
@@ -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
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 -O2 -profiling -s TOTAL_MEMORY=67108864 #-DWASM_INTERPRETER_DEBUG
cat src/js/post.js >> bin/wasm.js
diff --git a/check.py b/check.py
index ad222907f..84c7c3904 100755
--- a/check.py
+++ b/check.py
@@ -78,15 +78,17 @@ for c in tests:
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)] + extra)
+ subprocess.check_call(['./emcc_to_polyfill.sh', os.path.join('test', c)] + extra, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
if post:
open('a.normal.js', 'a').write(post)
open('a.wasm.js', 'a').write(post)
- proc = subprocess.Popen(['nodejs', 'a.normal.js'], stdout=subprocess.PIPE)
- out, err = proc.communicate()
- assert proc.returncode == 0
- if out.strip() != expected.strip():
- fail(out, expected)
+ for which in ['normal', 'wasm']:
+ print '....', which
+ proc = subprocess.Popen(['nodejs', 'a.' + which + '.js'], stdout=subprocess.PIPE)
+ out, err = proc.communicate()
+ assert proc.returncode == 0
+ if out.strip() != expected.strip():
+ fail(out, expected)
print '\n[ success! ]'
diff --git a/src/wasm-interpreter.h b/src/wasm-interpreter.h
index 2fcda535f..4733f5b90 100644
--- a/src/wasm-interpreter.h
+++ b/src/wasm-interpreter.h
@@ -226,7 +226,7 @@ public:
Flow flow = visit(curr->left);
if (flow.breaking()) return flow;
Literal left = flow.value;
- flow = visit(curr->left);
+ flow = visit(curr->right);
if (flow.breaking()) return flow;
Literal right = flow.value;
switch (curr->op) { // lmao
@@ -255,7 +255,7 @@ public:
Flow flow = visit(curr->left);
if (flow.breaking()) return flow;
Literal left = flow.value;
- flow = visit(curr->left);
+ flow = visit(curr->right);
if (flow.breaking()) return flow;
Literal right = flow.value;
switch (curr->op) { // :)
diff --git a/src/wasm-js.cpp b/src/wasm-js.cpp
index 813ad87eb..36ce6c4c7 100644
--- a/src/wasm-js.cpp
+++ b/src/wasm-js.cpp
@@ -58,9 +58,7 @@ 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
+ //std::cerr << *wasm << '\n';
if (debug) std::cerr << "generating exports...\n";
EM_ASM({