-
Notifications
You must be signed in to change notification settings - Fork 4.7k
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
Incorrect devirtualization in shared generic context #51982
Comments
Note this hits problem in both the VM and in crossgen2. The repro steps are without R2R, but there's a similar problem when compiled with crossgen2. |
Assigning to @trylek since he might be potentially working in the related typesystem code. |
For the runtime, behavior changes when the jit is optimizing:
I think the issue is here in runtime/src/coreclr/vm/jitinterface.cpp Lines 8918 to 8933 in 0ee10e9
Seems like instead, if we're presented with an exact owner type but shared interface type, we need to project the interface type to the corresponding exact interface type, instead of projecting the owner type to a shared type? Not sure if this is doable... |
@AndyAyersMS, its absolutely do-able, but what I think is a more reasonable approach, is that a devirtualize to |
In circumstances where the JIT doesn't provide exact enough details about the impl type and interface method to identify exactly which method should be called - In particular, when the impl class implements multiple copies of the target interface, and they are canonically compatible with the interface method that is to be called - Simply disable devirtualization for these scenarios Fixes #51982
Compile the above with
csc /noconfig /nostdlib Program.cs /r:System.Private.CoreLib.dll
and run with corerun.Output:
Now add
/O
to the csc command line.Output:
The text was updated successfully, but these errors were encountered: