summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/wasm-binary.h4
-rw-r--r--src/wasm/wasm-binary.cpp11
2 files changed, 4 insertions, 11 deletions
diff --git a/src/wasm-binary.h b/src/wasm-binary.h
index 562196580..2359d53bf 100644
--- a/src/wasm-binary.h
+++ b/src/wasm-binary.h
@@ -1526,10 +1526,6 @@ public:
std::map<Index, Name> elemTables;
- // we store elems here after being read from binary, until when we know their
- // names
- std::vector<std::unique_ptr<ElementSegment>> elementSegments;
-
// at index i we have all references to the memory i
std::map<Index, std::vector<wasm::Name*>> memoryRefs;
diff --git a/src/wasm/wasm-binary.cpp b/src/wasm/wasm-binary.cpp
index d449d4bdb..baff0d83f 100644
--- a/src/wasm/wasm-binary.cpp
+++ b/src/wasm/wasm-binary.cpp
@@ -2977,9 +2977,6 @@ void WasmBinaryBuilder::validateBinary() {
}
void WasmBinaryBuilder::processNames() {
- for (auto& segment : elementSegments) {
- wasm.addElementSegment(std::move(segment));
- }
for (auto& segment : dataSegments) {
wasm.addDataSegment(std::move(segment));
}
@@ -3178,7 +3175,7 @@ void WasmBinaryBuilder::readElementSegments() {
}
}
- elementSegments.push_back(std::move(segment));
+ wasm.addElementSegment(std::move(segment));
}
}
@@ -3348,7 +3345,7 @@ void WasmBinaryBuilder::readNames(size_t payloadLen) {
if (index < wasm.tables.size()) {
auto* table = wasm.tables[index].get();
- for (auto& segment : elementSegments) {
+ for (auto& segment : wasm.elementSegments) {
if (segment->table == table->name) {
segment->table = name;
}
@@ -3369,8 +3366,8 @@ void WasmBinaryBuilder::readNames(size_t payloadLen) {
auto rawName = getInlineString();
auto name = processor.process(rawName);
- if (index < elementSegments.size()) {
- elementSegments[index]->setExplicitName(name);
+ if (index < wasm.elementSegments.size()) {
+ wasm.elementSegments[index]->setExplicitName(name);
} else {
std::cerr << "warning: elem index out of bounds in name section, "
"elem subsection: "