summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJacob Gravelle <jgravelle@google.com>2018-06-01 17:07:38 -0700
committerSam Clegg <sbc@chromium.org>2018-06-01 17:07:38 -0700
commit408b8164d5849b15c4715901065232e79490ebcd (patch)
treee9bc8d50f28113573c25e110cc4026114dfd9d54 /src
parent1b99c7507d75566ba6314e157ceadfbbbe8301e5 (diff)
downloadbinaryen-408b8164d5849b15c4715901065232e79490ebcd.tar.gz
binaryen-408b8164d5849b15c4715901065232e79490ebcd.tar.bz2
binaryen-408b8164d5849b15c4715901065232e79490ebcd.zip
Always incorporate the table segment offset when calculating jsCallStartIndex (#1579)
Diffstat (limited to 'src')
-rw-r--r--src/wasm/wasm-emscripten.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/wasm/wasm-emscripten.cpp b/src/wasm/wasm-emscripten.cpp
index 58ef41c9b..3b658c3ff 100644
--- a/src/wasm/wasm-emscripten.cpp
+++ b/src/wasm/wasm-emscripten.cpp
@@ -207,16 +207,16 @@ struct JSCallWalker : public PostWalker<JSCallWalker> {
}
const auto& tableSegmentData = wasm.table.segments[0].data;
+ jsCallStartIndex =
+ wasm.table.segments[0].offset->cast<Const>()->value.getInteger();
// Check if jsCalls have already been created
for (Index i = 0; i < tableSegmentData.size(); ++i) {
if (tableSegmentData[i].startsWith("jsCall_")) {
- jsCallStartIndex = i;
+ jsCallStartIndex += i;
return;
}
}
- jsCallStartIndex =
- wasm.table.segments[0].offset->cast<Const>()->value.getInteger() +
- tableSegmentData.size();
+ jsCallStartIndex += tableSegmentData.size();
}
// Gather all function signatures used in call_indirect, because any of them