You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the managed type system tries to find implementation of IGen<string[]>._Init on Gen2DStringArray, it will try to match up the signature of _Init between those two types. The signatures don't match because the signature of _Init on Gen2DStringArray has EmbeddedSignatureData of type ArrayShape with contents 1.2.2.1||0,0, while the signature on the interface doesn't have an ArrayShape. The Equals check on the signature fails at callstack:
> ILCompiler.TypeSystem.dll!Internal.TypeSystem.MethodSignature.Equals(Internal.TypeSystem.MethodSignature otherSignature, bool allowCovariantReturn) Line 220 C#
ILCompiler.TypeSystem.dll!Internal.TypeSystem.MethodSignature.Equals(Internal.TypeSystem.MethodSignature otherSignature) Line 185 C#
ILCompiler.TypeSystem.dll!Internal.TypeSystem.MetadataVirtualMethodAlgorithm.FindMatchingVirtualMethodOnTypeByNameAndSig(Internal.TypeSystem.MethodDesc targetMethod, Internal.TypeSystem.DefType currentType, bool reverseMethodSearch, System.Func<Internal.TypeSystem.MethodDesc, Internal.TypeSystem.MethodDesc, bool> nameSigMatchMethodIsValidCandidate) Line 340 C#
ILCompiler.TypeSystem.dll!Internal.TypeSystem.MetadataVirtualMethodAlgorithm.ResolveInterfaceMethodToVirtualMethodOnType(Internal.TypeSystem.MethodDesc interfaceMethod, Internal.TypeSystem.MetadataType currentType) Line 601 C#
ILCompiler.TypeSystem.dll!Internal.TypeSystem.MetadataVirtualMethodAlgorithm.ResolveInterfaceMethodToVirtualMethodOnType(Internal.TypeSystem.MethodDesc interfaceMethod, Internal.TypeSystem.TypeDesc currentType) Line 565 C#
ILCompiler.TypeSystem.dll!Internal.TypeSystem.TypeSystemHelpers.ResolveInterfaceMethodToVirtualMethodOnType(Internal.TypeSystem.TypeDesc type, Internal.TypeSystem.MethodDesc interfaceMethod) Line 275 C#
There are more tests where this is failing, but I assume in crossgen2 this only means a failure to devirtualize in these tests. The failure mode is more brutal in NativeAOT.
But this can result in incorrect devirtualization with crossgen2 if there's a matching signature in one of the base types - I assume we don't have tests for that.
Cc @dotnet/crossgen-contrib
The text was updated successfully, but these errors were encountered:
- Change up the definition of an MDArray which doesn't need a special descriptor in the embedded signature data to match the type of mdarray thay everyone always uses. This fixes the virtual function handling behavior for all reasonable cases. (All cases where the MDArray is used for a base type in the expected fashion.)
- Add a devirtualization test for this specific scenario
Fixes#52444
ghost
removed
the
in-pr
There is an active PR which will close this issue when it is merged
label
May 31, 2021
ghost
locked as resolved and limited conversation to collaborators
Jun 30, 2021
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
I assume this is a regression from #51764.
In the \src\tests\JIT\Generics\Instantiation\Interfaces\Class05.cs test, we have a situation where:
When the managed type system tries to find implementation of
IGen<string[]>._Init
onGen2DStringArray
, it will try to match up the signature of_Init
between those two types. The signatures don't match because the signature of_Init
onGen2DStringArray
has EmbeddedSignatureData of type ArrayShape with contents1.2.2.1||0,0
, while the signature on the interface doesn't have an ArrayShape. The Equals check on the signature fails at callstack:There are more tests where this is failing, but I assume in crossgen2 this only means a failure to devirtualize in these tests. The failure mode is more brutal in NativeAOT.
But this can result in incorrect devirtualization with crossgen2 if there's a matching signature in one of the base types - I assume we don't have tests for that.
Cc @dotnet/crossgen-contrib
The text was updated successfully, but these errors were encountered: