[PATCH] D64738: Expand comment about how StringsToBuckets was computed, and add more entries

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jul 15 11:57:13 PDT 2019


This revision was automatically updated to reflect the committed changes.
Closed by commit rL366107: Expand comment about how StringsToBuckets was computed, and add more entries (authored by nico, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D64738?vs=209842&id=209927#toc

Repository:
  rL LLVM

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D64738/new/

https://reviews.llvm.org/D64738

Files:
  llvm/trunk/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp


Index: llvm/trunk/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp
===================================================================
--- llvm/trunk/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp
+++ llvm/trunk/lib/DebugInfo/PDB/Native/PDBStringTableBuilder.cpp
@@ -60,7 +60,19 @@
   // strings.  Matching the reference algorithm exactly is not strictly
   // necessary for correctness, but it helps when comparing LLD's PDBs with
   // Microsoft's PDBs so as to eliminate superfluous differences.
+  // The reference implementation does (in nmt.h, NMT::grow()):
+  //   unsigned StringCount = 0;
+  //   unsigned BucketCount = 1;
+  //   fn insert() {
+  //     ++StringCount;
+  //     if (BucketCount * 3 / 4 < StringCount)
+  //       BucketCount = BucketCount * 3 / 2 + 1;
+  //   }
+  // This list contains all StringCount, BucketCount pairs where BucketCount was
+  // just incremented.  It ends before the first BucketCount entry where
+  // BucketCount * 3 would overflow a 32-bit unsigned int.
   static std::map<uint32_t, uint32_t> StringsToBuckets = {
+      {0, 1},
       {1, 2},
       {2, 4},
       {4, 7},
@@ -110,7 +122,8 @@
       {229865455, 459730910},
       {344798183, 689596366},
       {517197275, 1034394550},
-      {775795913, 1551591826}};
+      {775795913, 1551591826},
+      {1163693870, 2327387740}};
   auto Entry = StringsToBuckets.lower_bound(NumStrings);
   assert(Entry != StringsToBuckets.end());
   return Entry->second;


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D64738.209927.patch
Type: text/x-patch
Size: 1471 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190715/0ba333ea/attachment.bin>


More information about the llvm-commits mailing list