Skip to content
Snippets Groups Projects
Commit 27b7c1e3 authored by Snehasish Kumar's avatar Snehasish Kumar
Browse files

Revert "[memprof] Fix frame deserialization on big endian systems."

This reverts commit c74389b4.

This broke the ml-opt-x86-64 build.
https://lab.llvm.org/buildbot#builders/9/builds/4127
parent ba653b7f
No related branches found
No related tags found
No related merge requests found
......@@ -161,7 +161,7 @@ struct MemProfRecord {
bool operator!=(const Frame &Other) const { return !operator==(Other); }
// Write the contents of the frame to the ostream \p OS.
void serialize(raw_ostream & OS) const {
void write(raw_ostream & OS) const {
using namespace support;
endian::Writer LE(OS, little);
......@@ -176,22 +176,6 @@ struct MemProfRecord {
LE.write<uint32_t>(Column);
LE.write<bool>(IsInlineFrame);
}
// Read a frame from char data which has been serialized as little endian.
static Frame deserialize(const unsigned char *Ptr) {
using namespace support;
return Frame(
/*Function=*/endian::readNext<uint64_t, little, unaligned>(Ptr),
/*LineOffset=*/endian::readNext<uint32_t, little, unaligned>(Ptr),
/*Column=*/endian::readNext<uint32_t, little, unaligned>(Ptr),
/*IsInlineFrame=*/endian::readNext<bool, little, unaligned>(Ptr));
}
// Returns the size of the frame information.
static constexpr size_t serializedSize() {
return sizeof(Frame::Function) + sizeof(Frame::LineOffset) +
sizeof(Frame::Column) + sizeof(Frame::IsInlineFrame);
}
});
// The dynamic calling context for the allocation.
......
......@@ -15,7 +15,7 @@ void serializeRecords(const ArrayRef<MemProfRecord> Records,
for (const MemProfRecord &MR : Records) {
LE.write<uint64_t>(MR.CallStack.size());
for (const MemProfRecord::Frame &F : MR.CallStack) {
F.serialize(OS);
F.write(OS);
}
MR.Info.serialize(Schema, OS);
}
......@@ -33,8 +33,8 @@ SmallVector<MemProfRecord, 4> deserializeRecords(const MemProfSchema &Schema,
const uint64_t NumFrames =
endian::readNext<uint64_t, little, unaligned>(Ptr);
for (uint64_t J = 0; J < NumFrames; J++) {
const auto F = MemProfRecord::Frame::deserialize(Ptr);
Ptr += MemProfRecord::Frame::serializedSize();
const auto F = *reinterpret_cast<const MemProfRecord::Frame *>(Ptr);
Ptr += sizeof(MemProfRecord::Frame);
MR.CallStack.push_back(F);
}
MR.Info.deserialize(Schema, Ptr);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment