summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorSam Clegg <sbc@chromium.org>2019-11-04 22:06:36 -0800
committerGitHub <noreply@github.com>2019-11-04 22:06:36 -0800
commit3cd309f8df18274d27f40465a05636f810352856 (patch)
treedc724c6139f5901f68ae86a76ea16e3de23ad41b /src
parent368f8a743c8322c3a01633f0cfa8ce205d58fb49 (diff)
downloadbinaryen-3cd309f8df18274d27f40465a05636f810352856.tar.gz
binaryen-3cd309f8df18274d27f40465a05636f810352856.tar.bz2
binaryen-3cd309f8df18274d27f40465a05636f810352856.zip
Don't attempt to de-duplicate asm consts (#2422)
Since we switched the using memory addresses for asm const indexes and stopping trying to modify the code we can no loner de-duplicate the asm const strings here. If we want to de-duplicate in the strings in emscripten we could do that but it seems like a marginal benefit. This fixes the test_html5_gamepad failures which is currently showing up on the emscripten waterfall.
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-emscripten.cpp24
1 files changed, 11 insertions, 13 deletions
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index d12bb9bba..690ce17d0 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -688,10 +688,11 @@ struct AsmConstWalker : public LinearExecutionWalker<AsmConstWalker> {
struct AsmConst {
std::set<std::string> sigs;
Address id;
+ std::string code;
Proxying proxy;
};
- std::map<std::string, AsmConst> asmConsts;
+ std::vector<AsmConst> asmConsts;
std::set<std::pair<std::string, Proxying>> allSigs;
// last sets in the current basic block, per index
std::map<Index, LocalSet*> sets;
@@ -839,14 +840,13 @@ AsmConstWalker::AsmConst& AsmConstWalker::createAsmConst(uint32_t id,
std::string code,
std::string sig,
Name name) {
- if (asmConsts.count(code) == 0) {
- AsmConst asmConst;
- asmConst.id = id;
- asmConst.sigs.insert(sig);
- asmConst.proxy = proxyType(name);
- asmConsts[code] = asmConst;
- }
- return asmConsts[code];
+ AsmConst asmConst;
+ asmConst.id = id;
+ asmConst.code = code;
+ asmConst.sigs.insert(sig);
+ asmConst.proxy = proxyType(name);
+ asmConsts.push_back(asmConst);
+ return asmConsts.back();
}
std::string AsmConstWalker::asmConstSig(std::string baseSig) {
@@ -1105,11 +1105,9 @@ std::string EmscriptenGlueGenerator::generateEmscriptenMetadata(
commaFirst = true;
if (!emAsmWalker.asmConsts.empty()) {
meta << " \"asmConsts\": {";
- for (auto& pair : emAsmWalker.asmConsts) {
- auto& code = pair.first;
- auto& asmConst = pair.second;
+ for (auto& asmConst : emAsmWalker.asmConsts) {
meta << nextElement();
- meta << '"' << asmConst.id << "\": [\"" << code << "\", ";
+ meta << '"' << asmConst.id << "\": [\"" << asmConst.code << "\", ";
printSet(meta, asmConst.sigs);
meta << ", [\"" << proxyingSuffix(asmConst.proxy) << "\"]";