summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-emscripten.cpp9
1 files changed, 6 insertions, 3 deletions
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index 3c78ce866..953a2edc3 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -331,6 +331,7 @@ void EmscriptenGlueGenerator::generateJSCallThunks(
JSCallWalker walker = getJSCallWalker(wasm);
auto& tableSegmentData = wasm.table.segments[0].data;
+ unsigned numEntriesAdded = 0;
for (std::string sig : walker.indirectlyCallableSigs) {
// Add imports for jsCall_sig (e.g. jsCall_vi).
// Imported jsCall_sig functions have their first parameter as an index to
@@ -371,11 +372,13 @@ void EmscriptenGlueGenerator::generateJSCallThunks(
f->body = call;
wasm.addFunction(f);
tableSegmentData.push_back(f->name);
+ numEntriesAdded++;
}
}
- wasm.table.initial = wasm.table.max =
- wasm.table.segments[0].offset->cast<Const>()->value.getInteger() +
- tableSegmentData.size();
+ wasm.table.initial.addr += numEntriesAdded;
+ if (wasm.table.max != Table::kUnlimitedSize) {
+ wasm.table.max.addr += numEntriesAdded;
+ }
}
std::vector<Address> getSegmentOffsets(Module& wasm) {