[lld] r281096 - Revert "Compact InputSectionData from 64 to 48 bytes. NFC."

Rafael Espindola via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 9 14:20:30 PDT 2016


Author: rafael
Date: Fri Sep  9 16:20:30 2016
New Revision: 281096

URL: http://llvm.org/viewvc/llvm-project?rev=281096&view=rev
Log:
Revert "Compact InputSectionData from 64 to 48 bytes. NFC."

This reverts commit r281084.

The link was failing on some bots. No idea why. I will try to
reproduce it on Monday.

Modified:
    lld/trunk/ELF/InputSection.cpp
    lld/trunk/ELF/InputSection.h

Modified: lld/trunk/ELF/InputSection.cpp
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.cpp?rev=281096&r1=281095&r2=281096&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.cpp (original)
+++ lld/trunk/ELF/InputSection.cpp Fri Sep  9 16:20:30 2016
@@ -50,8 +50,8 @@ template <class ELFT> size_t InputSectio
 template <class ELFT>
 ArrayRef<uint8_t> InputSectionBase<ELFT>::getSectionData() const {
   if (Compressed)
-    return ArrayRef<uint8_t>((const uint8_t *)UncompressedData.get(),
-                             UncompressedDataSize);
+    return ArrayRef<uint8_t>((const uint8_t *)Uncompressed.data(),
+                             Uncompressed.size());
   return check(this->File->getObj().getSectionContents(this->Header));
 }
 
@@ -106,10 +106,7 @@ template <class ELFT> void InputSectionB
     fatal(getName(this) + ": unsupported compression type");
 
   StringRef Buf((const char *)Data.data(), Data.size());
-  UncompressedDataSize = Hdr->ch_size;
-  UncompressedData.reset(new char[UncompressedDataSize]);
-  if (zlib::uncompress(Buf, UncompressedData.get(), UncompressedDataSize) !=
-      zlib::StatusOK)
+  if (zlib::uncompress(Buf, Uncompressed, Hdr->ch_size) != zlib::StatusOK)
     fatal(getName(this) + ": error uncompressing section");
 }
 

Modified: lld/trunk/ELF/InputSection.h
URL: http://llvm.org/viewvc/llvm-project/lld/trunk/ELF/InputSection.h?rev=281096&r1=281095&r2=281096&view=diff
==============================================================================
--- lld/trunk/ELF/InputSection.h (original)
+++ lld/trunk/ELF/InputSection.h Fri Sep  9 16:20:30 2016
@@ -61,9 +61,8 @@ public:
 
   StringRef Name;
 
-  // If a section is compressed, this has the uncompressed section data.
-  std::unique_ptr<char[]> UncompressedData;
-  size_t UncompressedDataSize = 0;
+  // If a section is compressed, this vector has uncompressed section data.
+  SmallVector<char, 0> Uncompressed;
 
   std::vector<Relocation> Relocations;
 };




More information about the llvm-commits mailing list