Skip to content

[Serialization] Do not serialize unstable hashes #75876

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 15, 2024

Conversation

bnbarham
Copy link
Contributor

llvm/llvm-project#96282 changed get_execution_seed to be non-deterministic. Use stable hashes instead.

llvm/llvm-project#96282 changed
`get_execution_seed` to be non-deterministic. Use stable hashes instead.
@bnbarham
Copy link
Contributor Author

@swift-ci please test

@@ -71,7 +71,7 @@ class LocalizationWriterInfo {
using hash_value_type = uint32_t;
using offset_type = uint32_t;

hash_value_type ComputeHash(key_type_ref key) { return llvm::hash_code(key); }
Copy link
Contributor Author

@bnbarham bnbarham Aug 14, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that this is a no-op - it was converting to 64 bits and then back to 32 bit. I was just here because I looked for all serialization tables 😅 . Seems worth changing since hash_code is a Hashing.h type.

@@ -330,7 +330,7 @@ class ModuleFileSharedCore::DeclMembersTableInfo {
}

hash_value_type ComputeHash(internal_key_type key) {
return llvm::hash_value(key);
return key;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hash_value ends up calling getHashValue and for a uint32_t that was just val * 37. Happy to change it to that, to reinterpret_cast then djbHash, or just leave it like this - let me know!

Copy link
Contributor

@xedin xedin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LocalizationFormat change looks good to me!

@bnbarham
Copy link
Contributor Author

@swift-ci please test macOS platform

Copy link
Contributor

@xymus xymus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@bnbarham bnbarham merged commit 4fc85d7 into swiftlang:main Aug 15, 2024
5 checks passed
@bnbarham bnbarham deleted the cherry-hash-fixes branch August 15, 2024 02:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants