Repository navigation
Use built-in HashCode in ILC instead of rolling our own - #136712
Merged
Merged
Conversation
Replaces custom hashing algorithms in MetadataRecord with the default framework hash (xxhash32).
|
Azure Pipelines: Successfully started running 3 pipeline(s). 13 pipeline(s) were filtered out due to trigger conditions. There may be pipelines that require an authorized user to comment /azp run to run. |
Contributor
|
Tagging subscribers to this area: @agocke, @dotnet/ilc-contrib |
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are reported for the metadata hashing update.
No open issues 🎉
What changed in this PR
Replaces ILC metadata records’ custom hash-combining logic with the framework’s System.HashCode, updating both the generator and its generated output.
Changes:
- Uses
HashCode.Addfor record-specific seeds, member values, and collection elements. - Caches the result of
ToHashCode()while retaining existing member-selection and recursion-guard logic.
| File | Description |
|---|---|
src/coreclr/tools/Common/Internal/Metadata/NativeFormat/Generator/WriterGen.cs |
Generates HashCode-based implementations instead of custom bitwise hashing. |
src/coreclr/tools/aot/ILCompiler.MetadataTransform/Internal/Metadata/NativeFormat/Writer/NativeFormatWriterGen.cs |
Updates generated metadata record implementations to match the generator. |
Review effort: Balanced
MichalStrehovsky
approved these changes
Oct 31, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Replaces custom hashing algorithms in MetadataRecord with the default framework hash (xxhash32).