diff options
Diffstat (limited to 'src/passes/FuncCastEmulation.cpp')
-rw-r--r-- | src/passes/FuncCastEmulation.cpp | 21 |
1 files changed, 12 insertions, 9 deletions
diff --git a/src/passes/FuncCastEmulation.cpp b/src/passes/FuncCastEmulation.cpp index a9302fb65..1ac32166e 100644 --- a/src/passes/FuncCastEmulation.cpp +++ b/src/passes/FuncCastEmulation.cpp @@ -172,18 +172,21 @@ struct FuncCastEmulation : public Pass { Signature ABIType(Type(std::vector<Type>(numParams, Type::i64)), Type::i64); // Add a thunk for each function in the table, and do the call through it. std::unordered_map<Name, Name> funcThunks; - for (auto& segment : module->table.segments) { - for (auto& name : segment.data) { - auto iter = funcThunks.find(name); - if (iter == funcThunks.end()) { - auto thunk = makeThunk(name, module, numParams); - funcThunks[name] = thunk; - name = thunk; - } else { - name = iter->second; + for (auto& table : module->tables) { + for (auto& segment : table->segments) { + for (auto& name : segment.data) { + auto iter = funcThunks.find(name); + if (iter == funcThunks.end()) { + auto thunk = makeThunk(name, module, numParams); + funcThunks[name] = thunk; + name = thunk; + } else { + name = iter->second; + } } } } + // update call_indirects ParallelFuncCastEmulation(ABIType, numParams).run(runner, module); } |