55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
|
-
+
-
-
+
-
-
-
-
+
|
option. But that just underlines the point that these fields are functionally
meant to be private and accessed only by Tcl. Better to have form and
function in agreement. There's evidence that at some point in the history
the Tcl_HashTable struct has also been extended (to grow the typePtr field).
That change also took place without benefit of a version field, so some
difficult to explain and maintain code is in Tcl_InitCustomHashTable.
The advantage of static Tcl_HashTable allocation by callers is diminished by
There is no thread safety built into the Tcl_HashTable system. Each
the fact that the routines in this module only function if thread isolation is
preserved. Any particular (Tcl_HashTable *) may only be passed into
Tcl_HashTable either has to be kept in thread isolation, or has to have
these routines by a single thread. This suggests HashTables belong in thread
specific memory, which already removes the static option of storage. Having
a routine to actually allocate the hash table makes it clear from the beginning
precisely which thread owns which table.
operations on it contained within mutex protection by the callers.
The customizable hash function is defined to return an unsigned int, so
only 2^32 distinct hashes can be used to sift data. According to the internal
logic of the hash table implementation, this means the existing architecture
is suitable for holding at most 3 * 2^32 entries. If we aim to store more than
that, the Tcl_HashKeyType will need to evolve.
|