Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

175 lines
7.6 KiB

  1. 2000/11
  2. -------
  3. * Refactored the code
  4. * Public API
  5. * C API
  6. * Kernel-mode support
  7. * Fixed a deadlock bug in the table lock. If you explicitly call
  8. Table::ReadLock and Table::WriteLock, you >need< this fix, or
  9. you will deadlock under stress.
  10. * Fixed a bug in table compaction: until now, the table never
  11. actually compacted after elements were deleted, as the test
  12. for compaction always evaluated to `false'.
  13. * Changed the signature of AddRefRecord. The second parameter is
  14. now an LK_ADDREF_REASON, instead of an int whose value is +1
  15. or -1. The reason code aids in debugging refcount leaks. If
  16. its value is negative, the refcount should be decremented;
  17. otherwise the refcount should be incremented.
  18. * Changed behavior of ApplyIf locking: now locks one subtable
  19. at a time, instead of all subtables. Can use ReadLock or
  20. WriteLock to retain old behavior.
  21. * Changed names and signatures of void LKRHashTableInit() and
  22. void LKRHashTableUninit(), to BOOL LKR_Initialize(DWORD) and
  23. void LKR_Terminate(), respectively.
  24. 2000/07/31
  25. ----------
  26. * >REALLY< fixed the bug in Clear that left certain internal state
  27. variables in an inconsistent state. If you later
  28. inserted/deleted enough new records, LKRhash would AV. (The
  29. fix in the 2000/03/22 release did not work in all cases.)
  30. 2000/04/24
  31. ----------
  32. * I added support for STL-style iterators
  33. * New iterators DO NOT LOCK the table or a bucket chain. In
  34. a multithreaded situation, it is YOUR responsibility to
  35. call WriteLock (or ReadLock) on the table before
  36. initializing any iterators, and to call WriteUnlock (or
  37. ReadUnlock) when you are finished.
  38. * The table provides begin() and end() methods. As the compiler
  39. isn't quite smart enough to realize that end() always
  40. returns a trivial empty iterator, a loop such as
  41. MyTable::iterator iter;
  42. for (iter = pTbl->begin(); iter != pTbl->end(); ++iter) ...
  43. is more efficiently expressed as
  44. MyTable::iterator iter;
  45. MyTable::iterator iterEnd = pTbl->end();
  46. for (iter = pTbl->begin(); iter != iterEnd; ++iter) ...
  47. * iterators can be pre- and post-incremented; i.e.:
  48. ++iter and iter++
  49. Pre-increment is more efficient.
  50. * Table provides a constructor that accepts a range of
  51. iterators into another container.
  52. * Provides an Insert method that returns an iterator,
  53. pointing to the newly inserted record, or end() on
  54. failure.
  55. * Provides a Find method that returns an iterator pointing
  56. to the record with the passed-in key, or end() on
  57. failure.
  58. * Provides an EqualRange method that returns two iterators
  59. describing the range that contain all the records whose
  60. keys match the passed-in key. Until full support for
  61. multiple, identical keys is added, the range will contain
  62. either zero or one record(s).
  63. * Provides an Erase method that deletes the record pointed
  64. to by the iterator. Updates the iterator to point to the
  65. next record in the table.
  66. * Provides an Erase method that takes two iterators, which
  67. will delete all the records in the range described by the
  68. two iterators.
  69. * Unlike the old, deprecated iterators (CIterator), more
  70. than one iterator can be active at a time. It is best not
  71. to call the non-iterator insert/delete methods
  72. (InsertRecord, DeleteRecord, DeleteKey) while iterators
  73. are open, as the non-iterator methods can rebalance bucket
  74. chains, leading to invalid iterators, undercounting,
  75. and/or overcounting. This is true even if the table was
  76. WriteLocked, before the iterators were initialized. It is
  77. best to use the iterator Insert or Erase methods in such a
  78. case.
  79. * The iterators are reference-counted.
  80. * I have provided an NTSD/CDB debugger extension, lkrdbg.dll,
  81. with one method, !lkrdbg.lkrhash:
  82. * !lkrhash -l[0-2] <addr> will dump the hashtable at <addr>
  83. at verbosity level l (default 0)
  84. * !lkrhash -g[0-2] will dump ALL hashtables at
  85. at verbosity level l (default 0)
  86. * I have provided an easy-to-use customization mechanism in
  87. <lkrcust.h> to provide custom dumps for different
  88. hashtables. It's keyed off the pszName parameter used in
  89. the hashtable constructor. You can provide a custom dump
  90. routine for the table (to dump whatever other fields you
  91. might have added), as well as a custom dump routine for
  92. the record class stored by the hashtable. Provided three
  93. examples of customization, based on the samples.
  94. * Fixed various build issues
  95. * All debug code is now bracketed with #ifdef IRTLDEBUG
  96. (instead of #ifdef _DEBUG). Currently equivalent, but you
  97. can control this in <irtldbg.h>
  98. * Fix all Unicode build issues. Code is now TCHAR-aware.
  99. * Added lkrhash.rc to provide a version resource
  100. * Turned on `LKRhash' and `HashFn' namespaces by default. See readme.txt.
  101. * Reorganized the samples into their own subtree.
  102. * Removed more old code that used to be present so that I could
  103. test some changes (e.g., stuff bracketed by LKR_OLD_SEGMENT,
  104. LKR_SIGS_NODES, etc).
  105. * Bucket Lock is once again CSmallSpinLock, unless
  106. LKR_DEPRECATED_ITERATORS is defined (off by default).
  107. * Moved a lot of nested classes out of the table classes, to be
  108. top-level classes.
  109. * Better compile-time and run-time assertions.
  110. 2000/03/22
  111. ----------
  112. * Fixed a bug in Clear that left certain internal state variables
  113. in an inconsistent state. If you later inserted/deleted enough
  114. new records, LKRhash would AV.
  115. * Changed BucketLock to CReaderWriterLock3 (recursive MRSW lock)
  116. to support certain scenarios, such as being able to call
  117. FindKey while enumerating with an old-style iterator. Slightly
  118. slower, but the speed improvements below more than compensate.
  119. * Removed the 300-line example from the end of lkrhash.h. Now in
  120. hashtest.cpp, bracketed by SAMPLE_LKRHASH_TESTCLASS.
  121. * Replaced TRACE macro with IRTLTRACE so as not to interfere with
  122. other TRACE macros (e.g., MFC's)
  123. * Added dirs and sources files so that you can build LKRhash with
  124. the NT build environment.
  125. * Added STATIC_ASSERT macro for compile-time assertions. The
  126. IRTLASSERT macro is still used for run-time assertions.
  127. * Removed old code that used to be present so that I could test
  128. some changes (e.g., stuff bracketed by LKR_NEWCODE, LKR_MASK,
  129. LKR_SUBTABLE, LKR_COMPACT_DELETE, etc)
  130. * Upped LK_DFLT_MAXLOAD to 6 (NODES_PER_CLUMP) to get better
  131. memory usage
  132. * Added support for RockAll (not enabled by default)
  133. * Turned CSegment into a concrete base class. Somewhat hacky but faster.
  134. * Made the locks a little faster, esp. CReaderWriterLock3::IsWriteLocked
  135. * Experimented with countdown loops (turned out to be slightly
  136. slower).
  137. * Experimented with bitwise scrambling for subtable index
  138. calculation. Faster.
  139. * Experimented with using a bitwise mask for subtable index
  140. calculation. Faster.
  141. * Removed some inlines from lkrhash.h to improve modularity.
  142. * Removed unimplemented Print methods.
  143. * Bracketed global lists of hashtables with LKR_NO_GLOBAL_LIST.
  144. * Reduced number of subtables to min(1, #CPUs) for LK_SMALL_TABLESIZE
  145. Was min(2, #CPUs). Max number of subtables is now 64.
  146. 1999/11/04
  147. ----------
  148. * New reader-writer locks
  149. * Smarter, faster simple spinlocks
  150. * compact delete
  151. * debugging support
  152. * increased default load factor from 4.0 to 5.0 after reducing
  153. size of spinlock => reduced memory usage
  154. * deprecated CIterator
  155. * better error checking
  156. * Win64 clean
  157. * expose table locks => composition of operations
  158. * global list
  159. * faster hash scrambling function
  160. * won't fail messily in low-memory situations
  161. * fixed a race condition in some of the assertions
  162. * enhanced test program