Skip to content

Fix devirtualization across genericness in the hierarchy#108442

Merged
MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:devirtgeneric
Oct 1, 2024
Merged

Fix devirtualization across genericness in the hierarchy#108442
MichalStrehovsky merged 1 commit into
dotnet:mainfrom
MichalStrehovsky:devirtgeneric

Conversation

@MichalStrehovsky

Copy link
Copy Markdown
Member

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 #108379 that unlocked more whole program devirtualization and StringSearchValuesBase is in this shape. It is hittable without that optimization though, like the regression test shows.

Cc @dotnet/ilc-contrib

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.
@dotnet-policy-service

Copy link
Copy Markdown
Contributor

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

@MichalStrehovsky

Copy link
Copy Markdown
Member Author

/azp run runtime-nativeaot-outerloop

@azure-pipelines

Copy link
Copy Markdown
Azure Pipelines successfully started running 1 pipeline(s).

@MichalStrehovsky MichalStrehovsky merged commit e6d9f74 into dotnet:main Oct 1, 2024
@MichalStrehovsky MichalStrehovsky deleted the devirtgeneric branch October 1, 2024 22:11
@MichalStrehovsky

Copy link
Copy Markdown
Member Author

@dotnet/ilc-contrib anyone have opinion on backport? This is a .NET 9 regression that nobody ran into yet, but it's bad codegen (wrong method getting called).

@jkotas

jkotas commented Oct 2, 2024

Copy link
Copy Markdown
Member

I think silent bad codegen that is regression from last release meets the servicing bar. The targeted repro looks very simple, likely to be hit by somebody.

@agocke

agocke commented Oct 2, 2024

Copy link
Copy Markdown
Member

I agree, regression from .NET 8 makes it worth taking. I will bring it to tactics

@agocke

agocke commented Oct 2, 2024

Copy link
Copy Markdown
Member

/backport to release/9.0-staging

@github-actions

github-actions Bot commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

Started backporting to release/9.0-staging: https://github.com/dotnet/runtime/actions/runs/11136710712

@github-actions

github-actions Bot commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

@agocke an error occurred while backporting to release/9.0-staging, please check the run log for details!

Error: The specified backport target branch release/9.0-staging wasn't found in the repo.

@agocke

agocke commented Oct 2, 2024

Copy link
Copy Markdown
Member

/backport to release/9.0

@github-actions

github-actions Bot commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

Started backporting to release/9.0: https://github.com/dotnet/runtime/actions/runs/11136775970

@github-actions

github-actions Bot commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

@agocke backporting to release/9.0 failed, the patch most likely resulted in conflicts:

$ git am --3way --empty=keep --ignore-whitespace --keep-non-patch changes.patch

Applying: Fix devirtualization across genericness in the hierarchy
Using index info to reconstruct a base tree...
M	src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs
Falling back to patching base and 3-way merge...
Auto-merging src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs
CONFLICT (content): Merge conflict in src/coreclr/tools/aot/ILCompiler.Compiler/Compiler/ILScanner.cs
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
hint: When you have resolved this problem, run "git am --continue".
hint: If you prefer to skip this patch, run "git am --skip" instead.
hint: To restore the original branch and stop patching, run "git am --abort".
hint: Disable this message with "git config advice.mergeConflict false"
Patch failed at 0001 Fix devirtualization across genericness in the hierarchy
Error: The process '/usr/bin/git' failed with exit code 128

Please backport manually!

@github-actions

github-actions Bot commented Oct 2, 2024

Copy link
Copy Markdown
Contributor

@agocke an error occurred while backporting to release/9.0, please check the run log for details!

Error: git am failed, most likely due to a merge conflict.

MichalStrehovsky added a commit to MichalStrehovsky/runtime that referenced this pull request Oct 2, 2024
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.
@MichalStrehovsky

Copy link
Copy Markdown
Member Author

backporting to release/9.0 failed, the patch most likely resulted in conflicts:

Conflicts because of #108116. Not the first time random "fix typos"/"reformat code" caused extra busywork for nothing. Now I get to spend 10 minutes on something that should have been 10 seconds.

sirntar pushed a commit to sirntar/runtime that referenced this pull request Oct 3, 2024
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.
jeffschwMSFT added a commit that referenced this pull request Oct 3, 2024
…108470)

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 #108379 that unlocked more whole program devirtualization and `StringSearchValuesBase` is in this shape.

Co-authored-by: Jeff Schwartz <jeffschw@microsoft.com>
lambdageek pushed a commit to lambdageek/runtime that referenced this pull request Oct 3, 2024
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.
@github-actions github-actions Bot locked and limited conversation to collaborators Nov 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants