From 16c6b44da64630cd6906433cf35edabcea93cffc Mon Sep 17 00:00:00 2001 From: Alon Zakai <azakai@google.com> Date: Thu, 12 Dec 2019 19:15:39 -0800 Subject: 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 --- src/wasm-emscripten.h | 3 +++ 1 file changed, 3 insertions(+) (limited to 'src/wasm-emscripten.h') 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; -- cgit v1.2.3