diff --git a/src/ObjCRuntime/Stret.cs b/src/ObjCRuntime/Stret.cs index 6e48b121a90a..ae69ce77ab2a 100644 --- a/src/ObjCRuntime/Stret.cs +++ b/src/ObjCRuntime/Stret.cs @@ -38,144 +38,6 @@ namespace ObjCRuntime { class Stret { - static bool IsHomogeneousAggregateSmallEnough_Armv7k (Type t, int members) - { - // https://github.com/llvm-mirror/clang/blob/82f6d5c9ae84c04d6e7b402f72c33638d1fb6bc8/lib/CodeGen/TargetInfo.cpp#L5516-L5519 - return members <= 4; - } -#if !RGEN - static bool IsHomogeneousAggregateBaseType_Armv7k (Type t, Generator generator) - { - // https://github.com/llvm-mirror/clang/blob/82f6d5c9ae84c04d6e7b402f72c33638d1fb6bc8/lib/CodeGen/TargetInfo.cpp#L5500-L5514 -#if BGENERATOR - if (t == generator.TypeCache.System_Float || t == generator.TypeCache.System_Double || t == generator.TypeCache.System_nfloat) - return true; -#else - if (t == typeof (float) || t == typeof (double) || t == typeof (nfloat)) - return true; -#endif - - return false; - } - - static bool IsHomogeneousAggregate_Armv7k (List fieldTypes, Generator generator) - { - // Very simplified version of https://github.com/llvm-mirror/clang/blob/82f6d5c9ae84c04d6e7b402f72c33638d1fb6bc8/lib/CodeGen/TargetInfo.cpp#L4051 - // since C# supports a lot less types than clang does. - - if (fieldTypes.Count == 0) - return false; - - if (!IsHomogeneousAggregateSmallEnough_Armv7k (fieldTypes [0], fieldTypes.Count)) - return false; - - if (!IsHomogeneousAggregateBaseType_Armv7k (fieldTypes [0], generator)) - return false; - - for (int i = 1; i < fieldTypes.Count; i++) { - if (fieldTypes [0] != fieldTypes [i]) - return false; - } - - return true; - } -#endif - -#if BGENERATOR - public static bool ArmNeedStret (Type returnType, Generator generator) - { - bool has32bitArm; -#if BGENERATOR - has32bitArm = generator.CurrentPlatform != PlatformName.TvOS && generator.CurrentPlatform != PlatformName.MacOSX; -#elif MONOMAC || __TVOS__ - has32bitArm = false; -#else - has32bitArm = true; -#endif - if (!has32bitArm) - return false; - - Type t = returnType; - - if (!t.IsValueType || t.IsEnum || IsBuiltInType (t)) - return false; - - var fieldTypes = new List (); - var size = GetValueTypeSize (t, fieldTypes, false, generator); - - bool isWatchOS; -#if BGENERATOR - isWatchOS = generator.CurrentPlatform == PlatformName.WatchOS; -#else - isWatchOS = false; -#endif - - if (isWatchOS) { - // According to clang watchOS passes arguments bigger than 16 bytes by reference. - // https://github.com/llvm-mirror/clang/blob/82f6d5c9ae84c04d6e7b402f72c33638d1fb6bc8/lib/CodeGen/TargetInfo.cpp#L5248-L5250 - // https://github.com/llvm-mirror/clang/blob/82f6d5c9ae84c04d6e7b402f72c33638d1fb6bc8/lib/CodeGen/TargetInfo.cpp#L5542-L5543 - if (size <= 16) - return false; - - // Except homogeneous aggregates, which are not stret either. - if (IsHomogeneousAggregate_Armv7k (fieldTypes, generator)) - return false; - } - - bool isiOS; -#if BGENERATOR - isiOS = generator.CurrentPlatform == PlatformName.iOS; -#elif __IOS__ - isiOS = true; -#else - isiOS = false; -#endif - - if (isiOS) { - if (size <= 4 && fieldTypes.Count == 1) { - switch (fieldTypes [0].FullName) { - case "System.Char": - case "System.Byte": - case "System.SByte": - case "System.UInt16": - case "System.Int16": - case "System.UInt32": - case "System.Int32": - case "System.IntPtr": - case "System.UIntPtr": - case "System.nuint": - case "System.nint": - return false; - // floating-point types are stret - } - } - } - - return true; - } -#endif // BGENERATOR - -#if BGENERATOR || RGEN - public static bool X86NeedStret (Type returnType, Generator generator) - { - Type t = returnType; - - if (!t.IsValueType || t.IsEnum || IsBuiltInType (t)) - return false; - - var fieldTypes = new List (); - var size = GetValueTypeSize (t, fieldTypes, false, generator); - - if (size > 8) - return true; - - if (fieldTypes.Count == 3) - return true; - - return false; - } -#endif // BGENERATOR - public static bool X86_64NeedStret (Type returnType, Generator generator) { Type t = returnType; @@ -184,12 +46,12 @@ public static bool X86_64NeedStret (Type returnType, Generator generator) return false; var fieldTypes = new List (); - return GetValueTypeSize (t, fieldTypes, true, generator) > 16; + return GetValueTypeSize (t, fieldTypes, generator) > 16; } // IL2070: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields', 'DynamicallyAccessedMemberTypes.NonPublicFields' in call to 'System.Type.GetFields(BindingFlags)'. The parameter 'type' of method 'ObjCRuntime.Stret.GetValueTypeSize(Type, List, Boolean, Object)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [UnconditionalSuppressMessage ("", "IL2070", Justification = "Computing the size of a struct is safe, because the trimmer can't remove fields that would affect the size of a marshallable struct (it could affect marshalling behavior).")] - internal static int GetValueTypeSize (Type type, List fieldTypes, bool is_64_bits, Generator generator) + internal static int GetValueTypeSize (Type type, List fieldTypes, Generator generator) { int size = 0; int maxElementSize = 1; @@ -203,11 +65,11 @@ internal static int GetValueTypeSize (Type type, List fieldTypes, bool is_ var fieldOffset = (FieldOffsetAttribute) Attribute.GetCustomAttribute (field, typeof (FieldOffsetAttribute)); #endif var elementSize = 0; - GetValueTypeSize (type, field.FieldType, fieldTypes, is_64_bits, ref elementSize, ref maxElementSize, generator); + GetValueTypeSize (type, field.FieldType, fieldTypes, ref elementSize, ref maxElementSize, generator); size = Math.Max (size, elementSize + fieldOffset.Value); } } else { - GetValueTypeSize (type, type, fieldTypes, is_64_bits, ref size, ref maxElementSize, generator); + GetValueTypeSize (type, type, fieldTypes, ref size, ref maxElementSize, generator); } if (size % maxElementSize != 0) @@ -226,10 +88,10 @@ static int AlignAndAdd (Type original_type, int size, int add, ref int max_eleme static bool IsBuiltInType (Type type) { - return IsBuiltInType (type, true /* doesn't matter */, out var _); + return IsBuiltInType (type, out var _); } - internal static bool IsBuiltInType (Type type, bool is_64_bits, out int type_size) + internal static bool IsBuiltInType (Type type, out int type_size) { type_size = 0; @@ -239,14 +101,14 @@ internal static bool IsBuiltInType (Type type, bool is_64_bits, out int type_siz if (type.Namespace == "ObjCRuntime") { switch (type.Name) { case "NativeHandle": - type_size = is_64_bits ? 8 : 4; + type_size = 8; return true; } return false; } else if (type.Namespace == "System.Runtime.InteropServices") { switch (type.Name) { case "NFloat": - type_size = is_64_bits ? 8 : 4; + type_size = 8; return true; } return false; @@ -280,7 +142,7 @@ internal static bool IsBuiltInType (Type type, bool is_64_bits, out int type_siz case "UIntPtr": case "nuint": case "nint": - type_size = is_64_bits ? 8 : 4; + type_size = 8; return true; case "Void": return true; @@ -291,14 +153,14 @@ internal static bool IsBuiltInType (Type type, bool is_64_bits, out int type_siz // IL2070: 'this' argument does not satisfy 'DynamicallyAccessedMemberTypes.PublicFields', 'DynamicallyAccessedMemberTypes.NonPublicFields' in call to 'System.Type.GetFields(BindingFlags)'. The parameter 'type' of method 'ObjCRuntime.Stret.GetValueTypeSize(Type, Type, List, Boolean, Int32&, Int32&, Object)' does not have matching annotations. The source value must declare at least the same requirements as those declared on the target location it is assigned to. [UnconditionalSuppressMessage ("", "IL2070", Justification = "Computing the size of a struct is safe, because the trimmer can't remove fields that would affect the size of a marshallable struct (it could affect marshalling behavior).")] - static void GetValueTypeSize (Type original_type, Type type, List field_types, bool is_64_bits, ref int size, ref int max_element_size, Generator generator) + static void GetValueTypeSize (Type original_type, Type type, List field_types, ref int size, ref int max_element_size, Generator generator) { // FIXME: // SIMD types are not handled correctly here (they need 16-bit alignment). // However we don't annotate those types in any way currently, so first we'd need to // add the proper attributes so that the generator can distinguish those types from other types. - if (IsBuiltInType (type, is_64_bits, out var type_size) && type_size > 0) { + if (IsBuiltInType (type, out var type_size) && type_size > 0) { field_types.Add (type); size = AlignAndAdd (original_type, size, type_size, ref max_element_size); return; @@ -312,7 +174,7 @@ static void GetValueTypeSize (Type original_type, Type type, List field_ty var marshalAs = (MarshalAsAttribute) Attribute.GetCustomAttribute (field, typeof (MarshalAsAttribute)); #endif if (marshalAs is null) { - GetValueTypeSize (original_type, field.FieldType, field_types, is_64_bits, ref size, ref max_element_size, generator); + GetValueTypeSize (original_type, field.FieldType, field_types, ref size, ref max_element_size, generator); continue; } @@ -320,7 +182,7 @@ static void GetValueTypeSize (Type original_type, Type type, List field_ty switch (marshalAs.Value) { case UnmanagedType.ByValArray: var types = new List (); - GetValueTypeSize (original_type, field.FieldType.GetElementType (), types, is_64_bits, ref type_size, ref max_element_size, generator); + GetValueTypeSize (original_type, field.FieldType.GetElementType (), types, ref type_size, ref max_element_size, generator); multiplier = marshalAs.SizeConst; break; case UnmanagedType.U1: @@ -353,16 +215,7 @@ static void GetValueTypeSize (Type original_type, Type type, List field_ty #if BGENERATOR public static bool NeedStret (Type returnType, Generator generator) { - if (X86NeedStret (returnType, generator)) - return true; - - if (X86_64NeedStret (returnType, generator)) - return true; - - if (ArmNeedStret (returnType, generator)) - return true; - - return false; + return X86_64NeedStret (returnType, generator); } #endif // BGENERATOR } diff --git a/src/bgen/Generator.cs b/src/bgen/Generator.cs index 04f9bb38f300..02ee6624770d 100644 --- a/src/bgen/Generator.cs +++ b/src/bgen/Generator.cs @@ -3034,62 +3034,18 @@ void GenerateNewStyleInvoke (bool supercall, MethodInfo mi, MemberInformation mi bool x64_stret = Stret.X86_64NeedStret (returnType, this); bool aligned = AttributeManager.HasAttribute (mi); - if (CurrentPlatform == PlatformName.MacOSX || CurrentPlatform == PlatformName.MacCatalyst) { - if (x64_stret) { - print ("if (global::ObjCRuntime.Runtime.IsARM64CallingConvention) {"); - indent++; - GenerateInvoke (false, supercall, mi, minfo, selector, args, category_type, false); - indent--; - print ("} else {"); - indent++; - GenerateInvoke (x64_stret, supercall, mi, minfo, selector, args, category_type, aligned && x64_stret); - indent--; - print ("}"); - } else { - GenerateInvoke (false, supercall, mi, minfo, selector, args, category_type, false); - } - return; - } - - bool arm_stret = Stret.ArmNeedStret (returnType, this); - bool x86_stret = Stret.X86NeedStret (returnType, this); - bool is_stret_multi = arm_stret || x86_stret || x64_stret; - bool need_multi_path = is_stret_multi; - - if (need_multi_path) { - if (is_stret_multi) { - // First check for arm64 - print ("if (global::ObjCRuntime.Runtime.IsARM64CallingConvention) {"); - indent++; - GenerateInvoke (false, supercall, mi, minfo, selector, args, category_type, false); - indent--; - // If we're not arm64, but we're 64-bit, then we're x86_64 - print ("} else if (IntPtr.Size == 8) {"); - indent++; - GenerateInvoke (x64_stret, supercall, mi, minfo, selector, args, category_type, aligned && x64_stret); - indent--; - // if we're not 64-bit, but we're on device, then we're 32-bit arm - print ("} else if (Runtime.Arch == Arch.DEVICE) {"); - indent++; - GenerateInvoke (arm_stret, supercall, mi, minfo, selector, args, category_type, aligned && arm_stret); - indent--; - // if we're none of the above, we're x86 - print ("} else {"); - indent++; - GenerateInvoke (x86_stret, supercall, mi, minfo, selector, args, category_type, aligned && x86_stret); - indent--; - print ("}"); - } else { - print ("if (IntPtr.Size == 8) {"); - indent++; - GenerateInvoke (x64_stret, supercall, mi, minfo, selector, args, category_type, aligned && x64_stret); - indent--; - print ("} else {"); - indent++; - GenerateInvoke (x86_stret, supercall, mi, minfo, selector, args, category_type, aligned && x86_stret); - indent--; - print ("}"); - } + if (x64_stret) { + // First check for arm64 + print ("if (global::ObjCRuntime.Runtime.IsARM64CallingConvention) {"); + indent++; + GenerateInvoke (false, supercall, mi, minfo, selector, args, category_type, false); + indent--; + // If we're not arm64, then we're x86_64 + print ("} else {"); + indent++; + GenerateInvoke (x64_stret, supercall, mi, minfo, selector, args, category_type, aligned && x64_stret); + indent--; + print ("}"); } else { GenerateInvoke (false, supercall, mi, minfo, selector, args, category_type, false); } diff --git a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs index f74a0b142ea8..58c3c3806dc9 100644 --- a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs +++ b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Core.cs @@ -280,10 +280,9 @@ public static (UnmanagedType Type, int SizeConst)? GetMarshalAs (this ISymbol sy /// Try to get the size of a built-in type. /// /// The symbol under test. - /// The platform target. /// The size of the native type. /// True if we could calculate the size. - internal static bool TryGetBuiltInTypeSize (this ITypeSymbol symbol, bool is64bits, out int size) + internal static bool TryGetBuiltInTypeSize (this ITypeSymbol symbol, out int size) { if (symbol.IsNested ()) { size = 0; @@ -300,13 +299,13 @@ internal static bool TryGetBuiltInTypeSize (this ITypeSymbol symbol, bool is64bi var (currentSize, result) = symbolInfo switch { { SpecialType: SpecialType.System_Void } => (0, true), - { ContainingNamespace: "ObjCRuntime", Name: "NativeHandle" } => (is64bits ? 8 : 4, true), - { ContainingNamespace: "System.Runtime.InteropServices", Name: "NFloat" } => (is64bits ? 8 : 4, true), + { ContainingNamespace: "ObjCRuntime", Name: "NativeHandle" } => (8, true), + { ContainingNamespace: "System.Runtime.InteropServices", Name: "NFloat" } => (8, true), { ContainingNamespace: "System", Name: "Char" or "Boolean" or "SByte" or "Byte" } => (1, true), { ContainingNamespace: "System", Name: "Int16" or "UInt16" } => (2, true), { ContainingNamespace: "System", Name: "Single" or "Int32" or "UInt32" } => (4, true), { ContainingNamespace: "System", Name: "Double" or "Int64" or "UInt64" } => (8, true), - { ContainingNamespace: "System", Name: "IntPtr" or "UIntPtr" or "nuint" or "nint" } => (is64bits ? 8 : 4, true), + { ContainingNamespace: "System", Name: "IntPtr" or "UIntPtr" or "nuint" or "nint" } => (8, true), _ => (0, false) }; #pragma warning restore format @@ -315,7 +314,7 @@ internal static bool TryGetBuiltInTypeSize (this ITypeSymbol symbol, bool is64bi } static bool TryGetBuiltInTypeSize (this ITypeSymbol type) - => TryGetBuiltInTypeSize (type, true /* doesn't matter */, out _); + => TryGetBuiltInTypeSize (type, out _); static int AlignAndAdd (int size, int add, ref int maxElementSize) { @@ -327,7 +326,7 @@ static int AlignAndAdd (int size, int add, ref int maxElementSize) static void GetValueTypeSize (this ITypeSymbol originalSymbol, ITypeSymbol type, List fieldSymbols, - bool is64Bits, ref int size, + ref int size, ref int maxElementSize) { // FIXME: @@ -335,7 +334,7 @@ static void GetValueTypeSize (this ITypeSymbol originalSymbol, ITypeSymbol type, // However, we don't annotate those types in any way currently, so first we'd need to // add the proper attributes so that the generator can distinguish those types from other types. - if (type.TryGetBuiltInTypeSize (is64Bits, out var typeSize) && typeSize > 0) { + if (type.TryGetBuiltInTypeSize (out var typeSize) && typeSize > 0) { fieldSymbols.Add (type); size = AlignAndAdd (size, typeSize, ref maxElementSize); return; @@ -345,7 +344,7 @@ static void GetValueTypeSize (this ITypeSymbol originalSymbol, ITypeSymbol type, foreach (var field in type.GetStructFields ()) { var marshalAs = field.GetMarshalAs (); if (marshalAs is null) { - GetValueTypeSize (originalSymbol, field.Type, fieldSymbols, is64Bits, ref size, ref maxElementSize); + GetValueTypeSize (originalSymbol, field.Type, fieldSymbols, ref size, ref maxElementSize); continue; } @@ -355,7 +354,7 @@ static void GetValueTypeSize (this ITypeSymbol originalSymbol, ITypeSymbol type, case UnmanagedType.ByValArray: var types = new List (); var arrayTypeSymbol = (field as IArrayTypeSymbol)!; - GetValueTypeSize (originalSymbol, arrayTypeSymbol.ElementType, types, is64Bits, ref typeSize, ref maxElementSize); + GetValueTypeSize (originalSymbol, arrayTypeSymbol.ElementType, types, ref typeSize, ref maxElementSize); multiplier = sizeConst; break; case UnmanagedType.U1: @@ -390,9 +389,8 @@ static void GetValueTypeSize (this ITypeSymbol originalSymbol, ITypeSymbol type, /// /// The type symbol whose size we want to get. /// The fileds of the struct. - /// If the calculation is for a 64b machine. /// - internal static int GetValueTypeSize (this ITypeSymbol type, List fieldTypes, bool is64Bits) + internal static int GetValueTypeSize (this ITypeSymbol type, List fieldTypes) { int size = 0; int maxElementSize = 1; @@ -402,11 +400,11 @@ internal static int GetValueTypeSize (this ITypeSymbol type, List f foreach (var field in type.GetStructFields ()) { var fieldOffset = field.GetFieldOffset (); var elementSize = 0; - GetValueTypeSize (type, field.Type, fieldTypes, is64Bits, ref elementSize, ref maxElementSize); + GetValueTypeSize (type, field.Type, fieldTypes, ref elementSize, ref maxElementSize); size = Math.Max (size, elementSize + fieldOffset); } } else { - GetValueTypeSize (type, type, fieldTypes, is64Bits, ref size, ref maxElementSize); + GetValueTypeSize (type, type, fieldTypes, ref size, ref maxElementSize); } if (size % maxElementSize != 0) diff --git a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Generator.cs b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Generator.cs index 9fa283687f8b..b3de104ff9bf 100644 --- a/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Generator.cs +++ b/src/rgen/Microsoft.Macios.Generator/Extensions/TypeSymbolExtensions.Generator.cs @@ -116,21 +116,6 @@ public static BindingTypeData GetBindingData (this ISymbol symbol) where T public static ForcedTypeData? GetForceTypeData (this ISymbol symbol) => GetAttribute (symbol, AttributesNames.ForcedTypeAttribute, ForcedTypeData.TryParse); - public static bool X86NeedStret (ITypeSymbol returnType) - { - if (!returnType.IsValueType || returnType.SpecialType == SpecialType.System_Enum || - returnType.TryGetBuiltInTypeSize ()) - return false; - - var fieldTypes = new List (); - var size = GetValueTypeSize (returnType, fieldTypes, false); - - if (size > 8) - return true; - - return fieldTypes.Count == 3; - } - public static bool X86_64NeedStret (ITypeSymbol returnType) { if (!returnType.IsValueType || returnType.SpecialType == SpecialType.System_Enum || @@ -138,47 +123,7 @@ public static bool X86_64NeedStret (ITypeSymbol returnType) return false; var fieldTypes = new List (); - return GetValueTypeSize (returnType, fieldTypes, true) > 16; - } - - public static bool ArmNeedStret (ITypeSymbol returnType, Compilation compilation) - { - var currentPlatform = compilation.GetCurrentPlatform (); - bool has32bitArm = currentPlatform != PlatformName.TvOS && currentPlatform != PlatformName.MacOSX; - if (!has32bitArm) - return false; - - ITypeSymbol t = returnType; - - if (!t.IsValueType || t.SpecialType == SpecialType.System_Enum || t.TryGetBuiltInTypeSize ()) - return false; - - var fieldTypes = new List (); - var size = t.GetValueTypeSize (fieldTypes, false); - - bool isiOS = currentPlatform == PlatformName.iOS; - - if (isiOS && size <= 4 && fieldTypes.Count == 1) { - -#pragma warning disable format - return fieldTypes [0] switch { - { Name: "nint" } => false, - { Name: "nuint" } => false, - { SpecialType: SpecialType.System_Char } => false, - { SpecialType: SpecialType.System_Byte } => false, - { SpecialType: SpecialType.System_SByte } => false, - { SpecialType: SpecialType.System_UInt16 } => false, - { SpecialType: SpecialType.System_Int16 } => false, - { SpecialType: SpecialType.System_UInt32 } => false, - { SpecialType: SpecialType.System_Int32 } => false, - { SpecialType: SpecialType.System_IntPtr } => false, - { SpecialType: SpecialType.System_UIntPtr } => false, - _ => true - }; -#pragma warning restore format - } - - return true; + return GetValueTypeSize (returnType, fieldTypes) > 16; } /// @@ -193,13 +138,7 @@ public static bool NeedsStret (this ITypeSymbol returnType, Compilation compilat if (returnType is IPointerTypeSymbol) return false; - if (X86NeedStret (returnType)) - return true; - - if (X86_64NeedStret (returnType)) - return true; - - return ArmNeedStret (returnType, compilation); + return X86_64NeedStret (returnType); } } diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/iOSExpectedPropertyTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/iOSExpectedPropertyTests.cs index 65d5c315578a..031f4c733b17 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/iOSExpectedPropertyTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Classes/Data/iOSExpectedPropertyTests.cs @@ -302,9 +302,9 @@ public virtual partial CoreGraphics.CGPoint Center { CoreGraphics.CGPoint ret; if (IsDirectBinding) { - ret = NSValue.ToCGPoint (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSend_stret (this.Handle, global::ObjCRuntime.Selector.GetHandle ("Center"))); + ret = NSValue.ToCGPoint (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("Center"))); } else { - ret = NSValue.ToCGPoint (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSendSuper_stret (this.Handle, global::ObjCRuntime.Selector.GetHandle ("Center"))); + ret = NSValue.ToCGPoint (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSendSuper (this.Handle, global::ObjCRuntime.Selector.GetHandle ("Center"))); } GC.KeepAlive (this); return ret; @@ -647,9 +647,9 @@ public virtual partial AVFoundation.AVCaptureReactionType ReactionType { AVFoundation.AVCaptureReactionType ret; if (IsDirectBinding) { - ret = global::AVFoundation.AVCaptureReactionTypeExtensions.GetValue (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSend_stret (this.Handle, global::ObjCRuntime.Selector.GetHandle ("canDraw"))); + ret = global::AVFoundation.AVCaptureReactionTypeExtensions.GetValue (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("canDraw"))); } else { - ret = global::AVFoundation.AVCaptureReactionTypeExtensions.GetValue (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSendSuper_stret (this.Handle, global::ObjCRuntime.Selector.GetHandle ("canDraw"))); + ret = global::AVFoundation.AVCaptureReactionTypeExtensions.GetValue (global::ObjCRuntime.Messaging.NativeHandle_objc_msgSendSuper (this.Handle, global::ObjCRuntime.Selector.GetHandle ("canDraw"))); } GC.KeepAlive (this); return ret; @@ -704,9 +704,9 @@ public virtual partial CoreGraphics.CGSize Size { CoreGraphics.CGSize ret; if (IsDirectBinding) { - ret = global::ObjCRuntime.Messaging.CGSize_objc_msgSend_stret (this.Handle, global::ObjCRuntime.Selector.GetHandle ("size")); + ret = global::ObjCRuntime.Messaging.CGSize_objc_msgSend (this.Handle, global::ObjCRuntime.Selector.GetHandle ("size")); } else { - ret = global::ObjCRuntime.Messaging.CGSize_objc_msgSendSuper_stret (this.Handle, global::ObjCRuntime.Selector.GetHandle ("size")); + ret = global::ObjCRuntime.Messaging.CGSize_objc_msgSendSuper (this.Handle, global::ObjCRuntime.Selector.GetHandle ("size")); } GC.KeepAlive (this); return ret; diff --git a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsSizeTests.cs b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsSizeTests.cs index 04e73950fcdf..83371b2b6f3d 100644 --- a/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsSizeTests.cs +++ b/tests/rgen/Microsoft.Macios.Generator.Tests/Extensions/TypeSymbolExtensionsSizeTests.cs @@ -246,17 +246,11 @@ public void TryGetBuiltInTypeSizeTests (ApplePlatform platform, string inputText Assert.NotNull (declaration); var symbol = semanticModel.GetDeclaredSymbol (declaration); Assert.NotNull (symbol); - // 32bit - var expectedResult = Stret.IsBuiltInType (type, false, out var expectedTypeSize); - var result = symbol.Type.TryGetBuiltInTypeSize (false, out var returnTypeSize); + + var expectedResult = Stret.IsBuiltInType (type, out var expectedTypeSize); + var result = symbol.Type.TryGetBuiltInTypeSize (out var returnTypeSize); Assert.Equal (expectedResult, result); Assert.Equal (expectedTypeSize, returnTypeSize); - - // 64bit - var expectedResult64 = Stret.IsBuiltInType (type, false, out var expectedTypeSize64); - var result64 = symbol.Type.TryGetBuiltInTypeSize (false, out var returnTypeSize64); - Assert.Equal (expectedResult64, result64); - Assert.Equal (expectedTypeSize64, returnTypeSize64); } class TestDataGetValueTypeSizeTests : IEnumerable { @@ -340,18 +334,7 @@ public struct AVSampleCursorSyncInfo { Stret.GetValueTypeSize ( type: typeof (AVSampleCursorSyncInfo), fieldTypes: new (), - is_64_bits: false, - generator: new object ()), - false]; - - yield return [ - avSampleCursorSyncInfo, - Stret.GetValueTypeSize ( - type: typeof (AVSampleCursorSyncInfo), - fieldTypes: new (), - is_64_bits: true, - generator: new object ()), - true]; + generator: new object ())]; const string avSampleCursorDependencyInfo = @" using System; @@ -386,18 +369,7 @@ public struct AVSampleCursorDependencyInfo { Stret.GetValueTypeSize ( type: typeof (AVSampleCursorDependencyInfo), fieldTypes: new (), - is_64_bits: false, - generator: new object ()), - false]; - - yield return [ - avSampleCursorDependencyInfo, - Stret.GetValueTypeSize ( - type: typeof (AVSampleCursorDependencyInfo), - fieldTypes: new (), - is_64_bits: true, - generator: new object ()), - true]; + generator: new object ())]; const string avsampleCursorStorageRange = @" using System; @@ -417,18 +389,7 @@ public struct AVSampleCursorStorageRange { Stret.GetValueTypeSize ( type: typeof (AVSampleCursorStorageRange), fieldTypes: new (), - is_64_bits: false, - generator: new object ()), - false]; - - yield return [ - avsampleCursorStorageRange, - Stret.GetValueTypeSize ( - type: typeof (AVSampleCursorStorageRange), - fieldTypes: new (), - is_64_bits: true, - generator: new object ()), - true]; + generator: new object ())]; const string avsampleCursorChunkInfo = @" using System; @@ -457,18 +418,7 @@ public struct AVSampleCursorChunkInfo { Stret.GetValueTypeSize ( type: typeof (AVSampleCursorChunkInfo), fieldTypes: new (), - is_64_bits: false, - generator: new object ()), - false]; - - yield return [ - avsampleCursorChunkInfo, - Stret.GetValueTypeSize ( - type: typeof (AVSampleCursorChunkInfo), - fieldTypes: new (), - is_64_bits: true, - generator: new object ()), - true]; + generator: new object ())]; } IEnumerator IEnumerable.GetEnumerator () => GetEnumerator (); @@ -476,7 +426,7 @@ public struct AVSampleCursorChunkInfo { [Theory] [AllSupportedPlatformsClassData] - public void GetValueTypeSizeTests (ApplePlatform platform, string inputText, int expectedSize, bool is64Bits) + public void GetValueTypeSizeTests (ApplePlatform platform, string inputText, int expectedSize) { var (compilation, syntaxTrees) = CreateCompilation (platform, sources: inputText); Assert.Single (syntaxTrees); @@ -487,7 +437,7 @@ public void GetValueTypeSizeTests (ApplePlatform platform, string inputText, int Assert.NotNull (declaration); var symbol = semanticModel.GetDeclaredSymbol (declaration); Assert.NotNull (symbol); - var x = symbol.GetValueTypeSize (new (), false); - Assert.Equal (expectedSize, symbol.GetValueTypeSize (new (), is64Bits)); + var x = symbol.GetValueTypeSize (new ()); + Assert.Equal (expectedSize, symbol.GetValueTypeSize (new ())); } }