summaryrefslogtreecommitdiff
path: root/src/wasm/wasm-emscripten.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/wasm/wasm-emscripten.cpp')
-rw-r--r--src/wasm/wasm-emscripten.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index fd0560fd9..c287087c9 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -143,7 +143,27 @@ inline void exportFunction(Module& wasm, Name name, bool must_export) {
wasm.addExport(exp);
}
+static bool hasI64(Signature sig) {
+ // We only generate dynCall functions for signatures that contain
+ // i64. This is because any other function can be called directly
+ // from JavaScript using the wasm table.
+ for (auto t : sig.results) {
+ if (t.getID() == Type::i64) {
+ return true;
+ }
+ }
+ for (auto t : sig.params) {
+ if (t.getID() == Type::i64) {
+ return true;
+ }
+ }
+ return false;
+}
+
void EmscriptenGlueGenerator::generateDynCallThunk(Signature sig) {
+ if (noDynCalls || (onlyI64DynCalls && !hasI64(sig))) {
+ return;
+ }
if (!sigs.insert(sig).second) {
return; // sig is already in the set
}