-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
Devirtualization isn't acting on devirtualizable calls past the first #39519
Comments
It's not readily apparent from the disassembly above, but both calls are in fact devirtualized. But this happens "late" as the object being dispatched is the return value from a call, and because of this, we currently can't do inlining or box removal optimizations.
The calls end up getting invoked via an indirection cell which makes them look like they're possibly still virtual. |
Linked this into the devirtualization "todo" issue #7541. Marking as future. |
Yep. This was likely "fixed" by dynamic PGO a while back, eg Runtime=.NET 9.0
but if you disable tiered compilation: EnvironmentVariables=DOTNET_TieredCompilation=0 Runtime=.NET 9.0
|
Ran from a VM due to dotnet/BenchmarkDotNet#1499
The idea is to do a two step virtual call, once dispatching from
this
(Combined) and once to a separate sealed class (Separate), JustMe is the control as it devirtualizes correctly.And the resulting asm:
.NET Core 5.0.0 (CoreCLR 5.0.20.30506, CoreFX 5.0.20.30506), X64 RyuJIT
.NET Core 5.0.0 (CoreCLR 5.0.20.30506, CoreFX 5.0.20.30506), X64 RyuJIT
.NET Core 5.0.0 (CoreCLR 5.0.20.30506, CoreFX 5.0.20.30506), X64 RyuJIT
Expectation would be that all benchmarks compile down to
mov eax, 1
category:cq
theme:devirtualization
skill-level:expert
cost:large
impact:medium
The text was updated successfully, but these errors were encountered: