forked from OSchip/llvm-project
[WebAssembly] Remove another trivial accessor.
Differential Revision: https://reviews.llvm.org/D43725 llvm-svn: 329336
This commit is contained in:
parent
7a598477aa
commit
ac95bb1d52
|
@ -140,12 +140,13 @@ DataSection::DataSection(ArrayRef<OutputSegment *> Segments)
|
||||||
writeUleb128(OS, WASM_OPCODE_END, "opcode:end");
|
writeUleb128(OS, WASM_OPCODE_END, "opcode:end");
|
||||||
writeUleb128(OS, Segment->Size, "segment size");
|
writeUleb128(OS, Segment->Size, "segment size");
|
||||||
OS.flush();
|
OS.flush();
|
||||||
Segment->setSectionOffset(BodySize);
|
|
||||||
|
Segment->SectionOffset = BodySize;
|
||||||
BodySize += Segment->Header.size() + Segment->Size;
|
BodySize += Segment->Header.size() + Segment->Size;
|
||||||
log("Data segment: size=" + Twine(Segment->Size));
|
log("Data segment: size=" + Twine(Segment->Size));
|
||||||
|
|
||||||
for (InputSegment *InputSeg : Segment->InputSegments)
|
for (InputSegment *InputSeg : Segment->InputSegments)
|
||||||
InputSeg->OutputOffset = Segment->getSectionOffset() +
|
InputSeg->OutputOffset = Segment->SectionOffset + Segment->Header.size() +
|
||||||
Segment->Header.size() +
|
|
||||||
InputSeg->OutputSegmentOffset;
|
InputSeg->OutputSegmentOffset;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -166,7 +167,7 @@ void DataSection::writeTo(uint8_t *Buf) {
|
||||||
|
|
||||||
parallelForEach(Segments, [&](const OutputSegment *Segment) {
|
parallelForEach(Segments, [&](const OutputSegment *Segment) {
|
||||||
// Write data segment header
|
// Write data segment header
|
||||||
uint8_t *SegStart = Buf + Segment->getSectionOffset();
|
uint8_t *SegStart = Buf + Segment->SectionOffset;
|
||||||
memcpy(SegStart, Segment->Header.data(), Segment->Header.size());
|
memcpy(SegStart, Segment->Header.data(), Segment->Header.size());
|
||||||
|
|
||||||
// Write segment data payload
|
// Write segment data payload
|
||||||
|
|
|
@ -32,12 +32,9 @@ public:
|
||||||
Size += InSeg->getSize();
|
Size += InSeg->getSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t getSectionOffset() const { return SectionOffset; }
|
|
||||||
|
|
||||||
void setSectionOffset(uint32_t Offset) { SectionOffset = Offset; }
|
|
||||||
|
|
||||||
StringRef Name;
|
StringRef Name;
|
||||||
const uint32_t Index;
|
const uint32_t Index;
|
||||||
|
uint32_t SectionOffset = 0;
|
||||||
uint32_t Alignment = 0;
|
uint32_t Alignment = 0;
|
||||||
uint32_t StartVA = 0;
|
uint32_t StartVA = 0;
|
||||||
std::vector<InputSegment *> InputSegments;
|
std::vector<InputSegment *> InputSegments;
|
||||||
|
@ -47,9 +44,6 @@ public:
|
||||||
|
|
||||||
// Segment header
|
// Segment header
|
||||||
std::string Header;
|
std::string Header;
|
||||||
|
|
||||||
private:
|
|
||||||
uint32_t SectionOffset = 0;
|
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace wasm
|
} // namespace wasm
|
||||||
|
|
Loading…
Reference in New Issue