Skip to content
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

[release/9.0] Fix devirtualization across genericness in the hierarchy #108470

Merged
merged 2 commits into from
Oct 3, 2024

Conversation

MichalStrehovsky
Copy link
Member

@MichalStrehovsky MichalStrehovsky commented Oct 2, 2024

Backport of #108442 to release/9.0

Customer Impact

  • Customer reported
  • Found internally

A new optimization added in 9.0 was causing incorrect devirtualization to a method on a base class instead of the correct more derived class.

Regression

  • Yes
  • No

Introduced in #97812 when the optimization was added.

Testing

This was found when I was making devirtualization kick in even more often in a .NET 10 PR. It is however hittable in .NET 9 too.

Risk

Should be low. The change was straightforward and none of our test passes found problems with it.

This code was trying to answer question: "Was this method overriden by something else in a more derived class"? It was walking the base hierarchy in canonical form, but that was leading to methods not resolving at all. The fix is to walk the non-canonical hierarchy and canonicalize after we resolved everything.

I ran into this in dotnet#108379 that unlocked more whole program devirtualization and `StringSearchValuesBase` is in this shape.
Copy link
Contributor

Tagging subscribers to this area: @agocke, @MichalStrehovsky, @jkotas
See info in area-owners.md if you want to be subscribed.

Copy link
Member

@jeffschwMSFT jeffschwMSFT left a comment

Choose a reason for hiding this comment

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

lgtm. please get a code review. we will take for consideration in 9 GA

@jeffschwMSFT jeffschwMSFT added the Servicing-consider Issue for next servicing release review label Oct 2, 2024
@jeffschwMSFT jeffschwMSFT added this to the 9.0.0 milestone Oct 2, 2024
@agocke agocke added Servicing-approved Approved for servicing release and removed Servicing-consider Issue for next servicing release review labels Oct 3, 2024
@jeffschwMSFT jeffschwMSFT merged commit 2924cc8 into dotnet:release/9.0 Oct 3, 2024
10 checks passed
@github-actions github-actions bot locked and limited conversation to collaborators Nov 3, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area-NativeAOT-coreclr Servicing-approved Approved for servicing release
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants