summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2015-11-02 13:00:23 -0800
committerAlon Zakai <alonzakai@gmail.com>2015-11-02 13:07:09 -0800
commit25a335b740da7e7f199edcad617251d19aa6b18b (patch)
treebf259819171a38a1eb57a170483a93fb6e501572
parent1a9469b0ed84be32dc264effbe7736a03cb7b608 (diff)
downloadbinaryen-25a335b740da7e7f199edcad617251d19aa6b18b.tar.gz
binaryen-25a335b740da7e7f199edcad617251d19aa6b18b.tar.bz2
binaryen-25a335b740da7e7f199edcad617251d19aa6b18b.zip
abort on switches, for now
-rwxr-xr-xbuild.sh2
-rw-r--r--src/asm2wasm.h6
-rw-r--r--src/wasm.h2
3 files changed, 7 insertions, 3 deletions
diff --git a/build.sh b/build.sh
index 2638f6922..68ac3b262 100755
--- a/build.sh
+++ b/build.sh
@@ -1,6 +1,6 @@
echo "building 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 -O3 -profiling -s TOTAL_MEMORY=67108864 -s SAFE_HEAP=1 -s ASSERTIONS=1 #-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 -s SAFE_HEAP=1 -s ASSERTIONS=1 #-DWASM_JS_DEBUG #-DWASM_INTERPRETER_DEBUG
cat src/js/post.js >> bin/wasm.js
diff --git a/src/asm2wasm.h b/src/asm2wasm.h
index e5ba3a499..7d8d4d47a 100644
--- a/src/asm2wasm.h
+++ b/src/asm2wasm.h
@@ -962,7 +962,11 @@ Function* Asm2WasmBuilder::processFunction(Ref ast) {
return ret;
} else if (what == SWITCH) {
// XXX switch is still in flux in the spec repo, just emit a placeholder
- return allocator.alloc<Nop>();
+#ifndef __EMSCRIPTEN__
+ return allocator.alloc<Nop>(); // ignore in reference interpreter
+#else
+ return allocator.alloc<Host>(); // XXX abort in wasm.js
+#endif
#if 0
IString name = getNextId("switch");
breakStack.push_back(name);
diff --git a/src/wasm.h b/src/wasm.h
index 95b44c344..e1ffe76a1 100644
--- a/src/wasm.h
+++ b/src/wasm.h
@@ -759,7 +759,7 @@ public:
ExpressionList operands;
std::ostream& doPrint(std::ostream &o, unsigned indent) {
- abort();
+ return printOpening(o, "host") << ')';
}
};