summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDerek Schuff <dschuff@chromium.org>2016-06-14 15:46:30 -0700
committerGitHub <noreply@github.com>2016-06-14 15:46:30 -0700
commit6fdd9dd2137a563bc41a85cf45178cc734e499a2 (patch)
treea3aeb3cc570da5702e143602c22e0df775c5e4ff /src
parent8f524e8f926b6993878f02334e730fe5f65096f6 (diff)
downloadbinaryen-6fdd9dd2137a563bc41a85cf45178cc734e499a2.tar.gz
binaryen-6fdd9dd2137a563bc41a85cf45178cc734e499a2.tar.bz2
binaryen-6fdd9dd2137a563bc41a85cf45178cc734e499a2.zip
Do not create dyncall thunks for functions with i64 results or params (#586)
Dyncall thunks are meant to be used with emscripten on the web; however on the web, functions with i64 results or params are not allowed to be exported.
Diffstat (limited to 'src')
-rw-r--r--src/wasm-linker.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/wasm-linker.cpp b/src/wasm-linker.cpp
index 1ec2defc9..e6a0a0514 100644
--- a/src/wasm-linker.cpp
+++ b/src/wasm-linker.cpp
@@ -357,12 +357,21 @@ void Linker::emscriptenGlue(std::ostream& o) {
o << " }\n";
}
+bool hasI64ResultOrParam(FunctionType* ft) {
+ if (ft->result == i64) return true;
+ for (auto ty : ft->params) {
+ if (ty == i64) return true;
+ }
+ return false;
+}
+
void Linker::makeDynCallThunks() {
std::unordered_set<std::string> sigs;
wasm::Builder wasmBuilder(out.wasm);
for (const auto& indirectFunc : out.wasm.table.names) {
std::string sig(getSig(out.wasm.getFunction(indirectFunc)));
auto* funcType = ensureFunctionType(sig, &out.wasm);
+ if (hasI64ResultOrParam(funcType)) continue; // Can't export i64s on the web.
if (!sigs.insert(sig).second) continue; // Sig is already in the set
std::vector<NameType> params;
params.emplace_back("fptr", i32); // function pointer param