summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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") << ')';
}
};