mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
[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:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user