File tree Expand file tree Collapse file tree 1 file changed +12
-14
lines changed
src/coreclr/tools/Common/TypeSystem/IL/Stubs Expand file tree Collapse file tree 1 file changed +12
-14
lines changed Original file line number Diff line number Diff line change @@ -76,24 +76,22 @@ public static MethodIL EmitIL(MethodDesc method)
7676 break ;
7777 default :
7878 result = false ;
79- var mdType = elementType as MetadataType ;
80- if ( mdType != null && mdType . Name == "Rune" && mdType . Namespace == "System.Text" )
79+ if ( elementType is MetadataType mdType )
8180 {
82- result = true ;
83- }
84- else if ( mdType != null && mdType . Name == "Char8" && mdType . Namespace == "System" )
85- {
86- result = true ;
87- }
88- else if ( mdType . IsValueType && ! ComparerIntrinsics . ImplementsIEquatable ( mdType . GetTypeDefinition ( ) ) )
89- {
90- MethodDesc objectEquals = mdType . Context . GetWellKnownType ( WellKnownType . Object ) . GetMethod ( "Equals" , null ) ;
91- if ( mdType . FindVirtualFunctionTargetMethodOnObjectType ( objectEquals ) . OwningType != mdType &&
92- ComparerIntrinsics . CanCompareValueTypeBits ( mdType , objectEquals ) )
81+ if ( mdType . Module == mdType . Context . SystemModule &&
82+ mdType . Namespace == "System.Text" &&
83+ mdType . Name == "Rune" )
9384 {
94- // Value type that can use memcmp and that doesn't override object.Equals or implement IEquatable<T>.Equals.
9585 result = true ;
9686 }
87+ else if ( mdType . IsValueType && ! ComparerIntrinsics . ImplementsIEquatable ( mdType . GetTypeDefinition ( ) ) )
88+ {
89+ // Value type that can use memcmp and that doesn't override object.Equals or implement IEquatable<T>.Equals.
90+ MethodDesc objectEquals = mdType . Context . GetWellKnownType ( WellKnownType . Object ) . GetMethod ( "Equals" , null ) ;
91+ result =
92+ mdType . FindVirtualFunctionTargetMethodOnObjectType ( objectEquals ) . OwningType != mdType &&
93+ ComparerIntrinsics . CanCompareValueTypeBits ( mdType , objectEquals ) ;
94+ }
9795 }
9896 break ;
9997 }
You can’t perform that action at this time.
0 commit comments