diff options
author | Sam Clegg <sbc@chromium.org> | 2019-12-19 10:58:06 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-12-19 10:58:06 -0800 |
commit | 81c16df401347e8e067fe9ccf0c26ae532bc03d5 (patch) | |
tree | 87ca0baff5fdc5f6efb2a0031c5cd64b33075258 /src | |
parent | 4d28d3f32e7f213e300b24bc61c3f0ac9d6e1ab6 (diff) | |
download | binaryen-81c16df401347e8e067fe9ccf0c26ae532bc03d5.tar.gz binaryen-81c16df401347e8e067fe9ccf0c26ae532bc03d5.tar.bz2 binaryen-81c16df401347e8e067fe9ccf0c26ae532bc03d5.zip |
Revert "Fix renaming in FixInvokeFunctionNamesWalker (#2513)" (#2541)
This reverts commit f0a2e2c75c7bb3008f10b6edbb8dc4cfd27b7d28.
Diffstat (limited to 'src')
-rw-r--r-- | src/wasm/wasm-emscripten.cpp | 21 |
1 files changed, 8 insertions, 13 deletions
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp index ae7e7f871..f069e558d 100644 --- a/src/wasm/wasm-emscripten.cpp +++ b/src/wasm/wasm-emscripten.cpp @@ -996,9 +996,8 @@ struct FixInvokeFunctionNamesWalker std::vector<Name> toRemove; std::set<Name> newImports; std::set<Signature> invokeSigs; - ImportInfo imports; - FixInvokeFunctionNamesWalker(Module& _wasm) : wasm(_wasm), imports(wasm) {} + FixInvokeFunctionNamesWalker(Module& _wasm) : wasm(_wasm) {} // Converts invoke wrapper names generated by LLVM backend to real invoke // wrapper names that are expected by JavaScript glue code. @@ -1053,18 +1052,15 @@ struct FixInvokeFunctionNamesWalker return; } - BYN_TRACE("renaming import: " << curr->module << "." << curr->base << " (" - << curr->name << ") -> " << newname << "\n"); - assert(importRenames.count(curr->base) == 0); - importRenames[curr->base] = newname; + assert(importRenames.count(curr->name) == 0); + BYN_TRACE("renaming: " << curr->name << " -> " << newname << "\n"); + importRenames[curr->name] = newname; // Either rename or remove the existing import - if (imports.getImportedFunction(curr->module, newname) || - !newImports.insert(newname).second) { - BYN_TRACE("using existing import\n"); + if (wasm.getFunctionOrNull(newname) || !newImports.insert(newname).second) { toRemove.push_back(curr->name); } else { - BYN_TRACE("renaming import\n"); curr->base = newname; + curr->name = newname; } } @@ -1073,11 +1069,10 @@ struct FixInvokeFunctionNamesWalker wasm.removeFunction(importName); } ModuleUtils::renameFunctions(wasm, importRenames); - // Update any associated GOT.func imports. + ImportInfo imports(wasm); for (auto& pair : importRenames) { + // Update any associated GOT.func import. if (auto g = imports.getImportedGlobal("GOT.func", pair.first)) { - BYN_TRACE("renaming corresponding GOT entry: " << g->base << " -> " - << pair.second << "\n"); g->base = pair.second; } } |