[PATCH] D21157: [pdb] Improve StreamInterface to support writing

Zachary Turner via llvm-commits llvm-commits at lists.llvm.org
Thu Jun 9 10:22:39 PDT 2016


zturner added inline comments.

================
Comment at: lib/DebugInfo/PDB/Raw/MappedBlockStream.cpp:47-48
@@ -46,3 +46,4 @@
 
   auto CacheIter = CacheMap.find(Offset);
   if (CacheIter != CacheMap.end()) {
+    // Try to find an alloc that was large enough for this request.
----------------
majnemer wrote:
> Doesn't this mean that larger queries that happened earlier are not reused?
> 
> Let's say we start with an empty cache.
> Then a read request for 4096 bytes from offset 0 happens.
> Then a read request for 1024 bytes at offset 1024 happens.
> Won't the second request not share with the first?
You are correct.  And I thought of that, but it makes the data structure more complicated, and I didn't think it was worth it for a code path that would almost never get exercised anyway.  This is mostly here so you don't shoot yourself in the foot, but as Rui mentioned earlier, read/write on the same pdb is not going to be a common thing at all, so I made it just smart enough that if you use it your program will still work, but still stupid enough that I didn't have to devise a new complicated data structure.


http://reviews.llvm.org/D21157





More information about the llvm-commits mailing list