diff options
-rw-r--r-- | src/wasm.h | 12 | ||||
-rw-r--r-- | src/wasm/wasm-binary.cpp | 8 | ||||
-rw-r--r-- | src/wasm/wasm-validator.cpp | 2 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/wasm.h b/src/wasm.h index 0050fcc28..5e4c4668b 100644 --- a/src/wasm.h +++ b/src/wasm.h @@ -1643,8 +1643,8 @@ public: std::unique_ptr<StackIR> stackIR; // local names. these are optional. - std::map<Index, Name> localNames; - std::map<Name, Index> localIndices; + std::unordered_map<Index, Name> localNames; + std::unordered_map<Name, Index> localIndices; // Source maps debugging info: map expression nodes to their file, line, col. struct DebugLocation { @@ -1878,10 +1878,10 @@ private: // TODO: add a build option where Names are just indices, and then these // methods are not needed // exports map is by the *exported* name, which is unique - std::map<Name, Export*> exportsMap; - std::map<Name, Function*> functionsMap; - std::map<Name, Global*> globalsMap; - std::map<Name, Event*> eventsMap; + std::unordered_map<Name, Export*> exportsMap; + std::unordered_map<Name, Function*> functionsMap; + std::unordered_map<Name, Global*> globalsMap; + std::unordered_map<Name, Event*> eventsMap; public: Module() = default; diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp index 2c473a254..75ca5a2b1 100644 --- a/src/wasm/wasm-binary.cpp +++ b/src/wasm/wasm-binary.cpp @@ -1894,7 +1894,7 @@ void WasmBinaryBuilder::readExports() { BYN_TRACE("== readExports\n"); size_t num = getU32LEB(); BYN_TRACE("num: " << num << std::endl); - std::set<Name> names; + std::unordered_set<Name> names; for (size_t i = 0; i < num; i++) { BYN_TRACE("read one\n"); auto curr = new Export; @@ -2524,7 +2524,7 @@ void WasmBinaryBuilder::readNames(size_t payloadLen) { } else if (nameType == BinaryConsts::UserSections::Subsection::NameFunction) { auto num = getU32LEB(); - std::set<Name> usedNames; + std::unordered_set<Name> usedNames; for (size_t i = 0; i < num; i++) { auto index = getU32LEB(); auto rawName = getInlineString(); @@ -2563,7 +2563,7 @@ void WasmBinaryBuilder::readNames(size_t payloadLen) { << std::to_string(funcIndex) << std::endl; } auto numLocals = getU32LEB(); - std::set<Name> usedNames; + std::unordered_set<Name> usedNames; for (size_t j = 0; j < numLocals; j++) { auto localIndex = getU32LEB(); auto rawLocalName = getInlineString(); @@ -2631,7 +2631,7 @@ void WasmBinaryBuilder::readNames(size_t payloadLen) { } } else if (nameType == BinaryConsts::UserSections::Subsection::NameGlobal) { auto num = getU32LEB(); - std::set<Name> usedNames; + std::unordered_set<Name> usedNames; for (size_t i = 0; i < num; i++) { auto index = getU32LEB(); auto rawName = getInlineString(); diff --git a/src/wasm/wasm-validator.cpp b/src/wasm/wasm-validator.cpp index a9a69b244..fad78cefd 100644 --- a/src/wasm/wasm-validator.cpp +++ b/src/wasm/wasm-validator.cpp @@ -2465,7 +2465,7 @@ void FunctionValidator::visitFunction(Function* curr) { returnTypes.clear(); labelNames.clear(); // validate optional local names - std::set<Name> seen; + std::unordered_set<Name> seen; for (auto& pair : curr->localNames) { Name name = pair.second; shouldBeTrue(seen.insert(name).second, name, "local names must be unique"); |