summaryrefslogtreecommitdiff
path: root/src/passes/LegalizeJSInterface.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/passes/LegalizeJSInterface.cpp')
-rw-r--r--src/passes/LegalizeJSInterface.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/passes/LegalizeJSInterface.cpp b/src/passes/LegalizeJSInterface.cpp
index 3a28e1745..61f3cfba5 100644
--- a/src/passes/LegalizeJSInterface.cpp
+++ b/src/passes/LegalizeJSInterface.cpp
@@ -112,6 +112,11 @@ struct LegalizeJSInterface : public Pass {
// Gather functions used in 'ref.func'. They should not be removed.
std::unordered_map<Name, std::atomic<bool>> usedInRefFunc;
+ // Fill in unordered_map, as we operate on it in parallel.
+ for (auto& func : module->functions) {
+ usedInRefFunc[func->name];
+ }
+
struct RefFuncScanner : public WalkerPass<PostWalker<RefFuncScanner>> {
Module& wasm;
std::unordered_map<Name, std::atomic<bool>>& usedInRefFunc;
@@ -125,12 +130,7 @@ struct LegalizeJSInterface : public Pass {
RefFuncScanner(
Module& wasm,
std::unordered_map<Name, std::atomic<bool>>& usedInRefFunc)
- : wasm(wasm), usedInRefFunc(usedInRefFunc) {
- // Fill in unordered_map, as we operate on it in parallel
- for (auto& func : wasm.functions) {
- usedInRefFunc[func->name];
- }
- }
+ : wasm(wasm), usedInRefFunc(usedInRefFunc) {}
void visitRefFunc(RefFunc* curr) { usedInRefFunc[curr->func] = true; }
};