[Serialization] Switch to a better hash seed for lookup tables

...fulfilling the promised audit from 0747d9a339. No intended
functionality change /other/ than the order of already-unsorted lists.
This affected a number of SIL tests that relied on deserialization
order matching the original source order; I have no idea why the old
hash logic would make that the case. If we think that's a valuable
property, we should serialize a list of functions in addition to the
iterable table. (Maybe just in SIB mode?)
This commit is contained in:
Jordan Rose
2019-08-15 14:44:20 -07:00
parent b0ad06ae30
commit c06e105bd0
17 changed files with 156 additions and 158 deletions

View File

@@ -391,8 +391,7 @@ public:
hash_value_type ComputeHash(internal_key_type key) {
if (key.first == DeclBaseName::Kind::Normal) {
// FIXME: DJB seed=0, audit whether the default seed could be used.
return llvm::djbHash(key.second, 0);
return llvm::djbHash(key.second, SWIFTMODULE_HASH_SEED);
} else {
return (hash_value_type)key.first;
}
@@ -454,8 +453,7 @@ public:
}
hash_value_type ComputeHash(internal_key_type key) {
// FIXME: DJB seed=0, audit whether the default seed could be used.
return llvm::djbHash(key, 0);
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
}
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {
@@ -515,8 +513,7 @@ public:
}
hash_value_type ComputeHash(internal_key_type key) {
// FIXME: DJB seed=0, audit whether the default seed could be used.
return llvm::djbHash(key, 0);
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
}
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {
@@ -551,8 +548,7 @@ public:
}
hash_value_type ComputeHash(internal_key_type key) {
// FIXME: DJB seed=0, audit whether the default seed could be used.
return llvm::djbHash(key, 0);
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
}
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {
@@ -607,8 +603,7 @@ public:
hash_value_type ComputeHash(internal_key_type key) {
if (key.first == DeclBaseName::Kind::Normal) {
// FIXME: DJB seed=0, audit whether the default seed could be used.
return llvm::djbHash(key.second, 0);
return llvm::djbHash(key.second, SWIFTMODULE_HASH_SEED);
} else {
return (hash_value_type)key.first;
}
@@ -782,8 +777,7 @@ public:
}
hash_value_type ComputeHash(internal_key_type key) {
// FIXME: DJB seed=0, audit whether the default seed could be used.
return llvm::djbHash(key, 0);
return llvm::djbHash(key, SWIFTMODULE_HASH_SEED);
}
static bool EqualKey(internal_key_type lhs, internal_key_type rhs) {