summaryrefslogtreecommitdiffstats
path: root/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2016-05-27 01:54:44 +0000
committerZachary Turner <zturner@google.com>2016-05-27 01:54:44 +0000
commit8dbe3629a09a754464f1420ce3059676c986090a (patch)
treea332a7c4b100869604af7066e58aa664ac623289 /llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
parentbd8e9542163f4218b6ad52df8c143c06263ff4a2 (diff)
downloadbcm5719-llvm-8dbe3629a09a754464f1420ce3059676c986090a.tar.gz
bcm5719-llvm-8dbe3629a09a754464f1420ce3059676c986090a.zip
[codeview,pdb] Try really hard to conserve memory when reading.
PDBs can be extremely large. We're already mapping the entire PDB into the process's address space, but to make matters worse the blocks of the PDB are not arranged contiguously. So, when we have something like an array or a string embedded into the stream, we have to make a copy. Since it's convenient to use traditional data structures to iterate and manipulate these records, we need the memory to be contiguous. As a result of this, we were using roughly twice as much memory as the file size of the PDB, because every stream was copied out and re-stitched together contiguously. This patch addresses this by improving the MappedBlockStream to allocate from a BumpPtrAllocator only when a read requires a discontiguous read. Furthermore, it introduces some data structures backed by a stream which can iterate over both fixed and variable length records of a PDB. Since everything is backed by a stream and not a buffer, we can read almost everything from the PDB with zero copies. Differential Revision: http://reviews.llvm.org/D20654 Reviewed By: ruiu llvm-svn: 270951
Diffstat (limited to 'llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp')
-rw-r--r--llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp b/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
index c359e7757d0..38d3f2f23e3 100644
--- a/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
+++ b/llvm/lib/DebugInfo/PDB/Raw/ModStream.cpp
@@ -32,17 +32,17 @@ Error ModStream::reload() {
return llvm::make_error<RawError>(raw_error_code::corrupt_file,
"Module has both C11 and C13 line info");
- if (auto EC = SymbolsSubstream.initialize(Reader, SymbolSize))
+ if (auto EC = SymbolsSubstream.load(Reader, SymbolSize))
return EC;
- if (auto EC = LinesSubstream.initialize(Reader, C11Size))
+ if (auto EC = Reader.readStreamRef(LinesSubstream, C11Size))
return EC;
- if (auto EC = C13LinesSubstream.initialize(Reader, C13Size))
+ if (auto EC = Reader.readStreamRef(C13LinesSubstream, C13Size))
return EC;
uint32_t GlobalRefsSize;
if (auto EC = Reader.readInteger(GlobalRefsSize))
return EC;
- if (auto EC = GlobalRefsSubstream.initialize(Reader, GlobalRefsSize))
+ if (auto EC = Reader.readStreamRef(GlobalRefsSubstream, GlobalRefsSize))
return EC;
if (Reader.bytesRemaining() > 0)
return llvm::make_error<RawError>(raw_error_code::corrupt_file,
OpenPOWER on IntegriCloud