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.
This linker pass deduplicates types and constants which are the same. It works by hashing and comparing the type/constant/annotation trees (of which a node is called an "entity"), and checking if all the members are the same.
To hash a type or compare two types, their trees are recursively walked and each node is hashed or compared. This is not done with anything smart for now, because we need to mind to handle recursive types in a way that yields the same hash for different types that have the same recursive structure. Recursive types are handled by storing all pointers in an ArrayHashMap, and if the pointer is already there (and so this is a recursive type), the index is hashed or compared instead of recursively processing it. For two equal types, these recursive pointers will have the same indices. This might seem like it would yield false positives, but in those cases there would also be a different type structure (for instance, an extra struct node in the tree), which is caught by the regular comparison code.
For some related yap on the linker, see the previous merge request, #19337