summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/wasm-binary.h3
-rw-r--r--src/wasm/wasm-binary.cpp11
2 files changed, 4 insertions, 10 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 2359d53bf..ab55b6f50 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1529,9 +1529,6 @@ public:
// at index i we have all references to the memory i
std::map<Index, std::vector<wasm::Name*>> memoryRefs;
- // we store data here after being read from binary, before we know their names
- std::vector<std::unique_ptr<DataSegment>> dataSegments;
-
// at index i we have all refs to the global i
std::map<Index, std::vector<Name*>> globalRefs;
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index baff0d83f..03ae5ce5a 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -2971,15 +2971,12 @@ Expression* WasmBinaryBuilder::popTypedExpression(Type type) {
}
void WasmBinaryBuilder::validateBinary() {
- if (hasDataCount && dataSegments.size() != dataCount) {
+ if (hasDataCount && wasm.dataSegments.size() != dataCount) {
throwError("Number of segments does not agree with DataCount section");
}
}
void WasmBinaryBuilder::processNames() {
- for (auto& segment : dataSegments) {
- wasm.addDataSegment(std::move(segment));
- }
// now that we have names, apply things
if (startIndex != static_cast<Index>(-1)) {
@@ -3072,7 +3069,7 @@ void WasmBinaryBuilder::readDataSegments() {
auto size = getU32LEB();
auto data = getByteView(size);
curr->data = {data.first, data.second};
- dataSegments.push_back(std::move(curr));
+ wasm.addDataSegment(std::move(curr));
}
}
@@ -3398,8 +3395,8 @@ void WasmBinaryBuilder::readNames(size_t payloadLen) {
auto index = getU32LEB();
auto rawName = getInlineString();
auto name = processor.process(rawName);
- if (index < dataSegments.size()) {
- dataSegments[i]->setExplicitName(name);
+ if (index < wasm.dataSegments.size()) {
+ wasm.dataSegments[i]->setExplicitName(name);
} else {
std::cerr << "warning: data index out of bounds in name section, "
"data subsection: "