summaryrefslogtreecommitdiff
path: root/src/wasm-emscripten.h
diff options
context:
space:
mode:
authorAlon Zakai <azakai@google.com>2019-12-12 19:15:39 -0800
committerGitHub <noreply@github.com>2019-12-12 19:15:39 -0800
commit16c6b44da64630cd6906433cf35edabcea93cffc (patch)
treef36d41e14f17b64bbfd3f7080cb624565fc11c59 /src/wasm-emscripten.h
parent89d1cf92be0636a219ee6415eead387241963dcf (diff)
downloadbinaryen-16c6b44da64630cd6906433cf35edabcea93cffc.tar.gz
binaryen-16c6b44da64630cd6906433cf35edabcea93cffc.tar.bz2
binaryen-16c6b44da64630cd6906433cf35edabcea93cffc.zip
Support stack overflow checks in standalone mode (#2525)
In normal mode we call a JS import, but we can't import from JS in standalone mode. Instead, just trap in that case with an unreachable. (The error reporting is not as good in this case, but at least it catches all errors and halts, and the emitted wasm is valid for standalone mode.) Helps emscripten-core/emscripten#10019
Diffstat (limited to 'src/wasm-emscripten.h')
-rw-r--r--src/wasm-emscripten.h3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/wasm-emscripten.h b/src/wasm-emscripten.h
index 8aa911ef9..c7689b4bc 100644
--- a/src/wasm-emscripten.h
+++ b/src/wasm-emscripten.h
@@ -31,6 +31,8 @@ public:
: wasm(wasm), builder(wasm), stackPointerOffset(stackPointerOffset),
useStackPointerGlobal(stackPointerOffset == 0) {}
+ void setStandalone(bool standalone_) { standalone = standalone_; }
+
void generateRuntimeFunctions();
Function* generateMemoryGrowthFunction();
Function* generateAssignGOTEntriesFunction();
@@ -69,6 +71,7 @@ private:
Builder builder;
Address stackPointerOffset;
bool useStackPointerGlobal;
+ bool standalone;
// Used by generateDynCallThunk to track all the dynCall functions created
// so far.
std::unordered_set<Signature> sigs;