diff options
Diffstat (limited to 'src/Common/src/TypeSystem/IL/ILProvider.cs')
-rw-r--r-- | src/Common/src/TypeSystem/IL/ILProvider.cs | 35 |
1 files changed, 23 insertions, 12 deletions
diff --git a/src/Common/src/TypeSystem/IL/ILProvider.cs b/src/Common/src/TypeSystem/IL/ILProvider.cs index d12904f38..eb1747beb 100644 --- a/src/Common/src/TypeSystem/IL/ILProvider.cs +++ b/src/Common/src/TypeSystem/IL/ILProvider.cs @@ -78,6 +78,16 @@ namespace Internal.IL return GetCanonTypeIntrinsic.EmitIL(method); } break; + case "EEType": + { + if (owningType.Namespace == "Internal.Runtime" && method.Name == "get_SupportsRelativePointers") + { + ILOpcode value = method.Context.Target.SupportsRelativePointers ? + ILOpcode.ldc_i4_1 : ILOpcode.ldc_i4_0; + return new ILStubMethodIL(method, new byte[] { (byte)value, (byte)ILOpcode.ret }, Array.Empty<LocalVariableDefinition>(), null); + } + } + break; } return null; @@ -202,7 +212,7 @@ namespace Internal.IL TypeSystemContext context = elementType.Context; MetadataType helperType = context.SystemModule.GetKnownType("Internal.IntrinsicSupport", "EqualityComparerHelpers"); - MethodDesc methodToCall = null; + MethodDesc methodToCall; if (elementType.IsEnum) { methodToCall = helperType.GetKnownMethod("EnumOnlyEquals", null).MakeInstantiatedMethod(elementType); @@ -215,18 +225,19 @@ namespace Internal.IL { methodToCall = helperType.GetKnownMethod("StructOnlyEqualsIEquatable", null).MakeInstantiatedMethod(elementType); } - - if (methodToCall != null) + else { - return new ILStubMethodIL(method, new byte[] - { - (byte)ILOpcode.ldarg_0, - (byte)ILOpcode.ldarg_1, - (byte)ILOpcode.call, 1, 0, 0, 0, - (byte)ILOpcode.ret - }, - Array.Empty<LocalVariableDefinition>(), new object[] { methodToCall }); + methodToCall = helperType.GetKnownMethod("StructOnlyNormalEquals", null).MakeInstantiatedMethod(elementType); } + + return new ILStubMethodIL(method, new byte[] + { + (byte)ILOpcode.ldarg_0, + (byte)ILOpcode.ldarg_1, + (byte)ILOpcode.call, 1, 0, 0, 0, + (byte)ILOpcode.ret + }, + Array.Empty<LocalVariableDefinition>(), new object[] { methodToCall }); } } } @@ -246,7 +257,7 @@ namespace Internal.IL if (((MetadataType)method.OwningType).HasCustomAttribute("System.Runtime.InteropServices", "McgIntrinsicsAttribute")) { var name = method.Name; - if (name == "Call") + if (name == "Call" || name.StartsWith("StdCall")) { return CalliIntrinsic.EmitIL(method); } |