From 11cb1967d82f1c3612fcbede1492dd55f5dd6a19 Mon Sep 17 00:00:00 2001 From: Rolf Bjarne Kvinge Date: Wed, 23 Apr 2025 18:07:20 +0200 Subject: [PATCH] [registrar] Remove 32-bit support. --- runtime/runtime.m | 12 ---------- runtime/xamarin/trampolines.h | 2 -- src/ObjCRuntime/DynamicRegistrar.cs | 12 ---------- src/ObjCRuntime/Method.cs | 12 ---------- src/ObjCRuntime/Registrar.cs | 36 ++++++++--------------------- src/ObjCRuntime/Runtime.cs | 2 -- tools/common/StaticRegistrar.cs | 24 +++++-------------- 7 files changed, 15 insertions(+), 85 deletions(-) diff --git a/runtime/runtime.m b/runtime/runtime.m index 639fb598252c..4d44191ad4d5 100644 --- a/runtime/runtime.m +++ b/runtime/runtime.m @@ -110,11 +110,9 @@ void* retain_tramp; void* static_tramp; void* ctor_tramp; - void* x86_double_abi_stret_tramp; void* static_fpret_single_tramp; void* static_fpret_double_tramp; void* static_stret_tramp; - void* x86_double_abi_static_stret_tramp; void* long_tramp; void* static_long_tramp; #if MONOMAC @@ -171,19 +169,9 @@ (void *) &xamarin_retain_trampoline, (void *) &xamarin_static_trampoline, (void *) &xamarin_ctor_trampoline, -#if defined (__i386__) - (void *) &xamarin_x86_double_abi_stret_trampoline, -#else - NULL, -#endif (void *) &xamarin_static_fpret_single_trampoline, (void *) &xamarin_static_fpret_double_trampoline, (void *) &xamarin_static_stret_trampoline, -#if defined (__i386__) - (void *) &xamarin_static_x86_double_abi_stret_trampoline, -#else - NULL, -#endif (void *) &xamarin_longret_trampoline, (void *) &xamarin_static_longret_trampoline, #if MONOMAC diff --git a/runtime/xamarin/trampolines.h b/runtime/xamarin/trampolines.h index 7919dfa910c4..590d25a3c9cf 100644 --- a/runtime/xamarin/trampolines.h +++ b/runtime/xamarin/trampolines.h @@ -31,11 +31,9 @@ id xamarin_retain_trampoline (id self, SEL sel); void xamarin_dealloc_trampoline (id self, SEL sel); void * xamarin_static_trampoline (id self, SEL sel, ...); void * xamarin_ctor_trampoline (id self, SEL sel, ...); -void xamarin_x86_double_abi_stret_trampoline (); float xamarin_static_fpret_single_trampoline (id self, SEL sel, ...); double xamarin_static_fpret_double_trampoline (id self, SEL sel, ...); void xamarin_static_stret_trampoline (void *buffer, id self, SEL sel, ...); -void xamarin_static_x86_double_abi_stret_trampoline (); long long xamarin_longret_trampoline (id self, SEL sel, ...); long long xamarin_static_longret_trampoline (id self, SEL sel, ...); id xamarin_copyWithZone_trampoline1 (id self, SEL sel, NSZone *zone); diff --git a/src/ObjCRuntime/DynamicRegistrar.cs b/src/ObjCRuntime/DynamicRegistrar.cs index d72fcf4dbf3b..8ac1bf007c3e 100644 --- a/src/ObjCRuntime/DynamicRegistrar.cs +++ b/src/ObjCRuntime/DynamicRegistrar.cs @@ -163,12 +163,6 @@ protected override bool IsSimulatorOrDesktop { } } - protected override bool Is64Bits { - get { - return IntPtr.Size == 8; - } - } - protected override bool IsARM64 { get { return Runtime.IsARM64CallingConvention; @@ -1117,12 +1111,6 @@ bool RegisterMethod (ObjCMethod method) case Trampoline.Stret: tramp = Method.StretTrampoline; break; - case Trampoline.X86_DoubleABI_StaticStretTrampoline: - tramp = Method.X86_DoubleABI_StaticStretTrampoline; - break; - case Trampoline.X86_DoubleABI_StretTrampoline: - tramp = Method.X86_DoubleABI_StretTrampoline; - break; #if MONOMAC case Trampoline.CopyWithZone1: tramp = Method.CopyWithZone1; diff --git a/src/ObjCRuntime/Method.cs b/src/ObjCRuntime/Method.cs index defa382bb196..5621b6604273 100644 --- a/src/ObjCRuntime/Method.cs +++ b/src/ObjCRuntime/Method.cs @@ -71,18 +71,6 @@ internal unsafe static IntPtr RetainTrampoline { } } - internal unsafe static IntPtr X86_DoubleABI_StretTrampoline { - get { - return Runtime.options->Trampolines->x86_double_abi_stret_tramp; - } - } - - internal unsafe static IntPtr X86_DoubleABI_StaticStretTrampoline { - get { - return Runtime.options->Trampolines->x86_double_abi_static_stret_tramp; - } - } - internal unsafe static IntPtr LongTrampoline { get { return Runtime.options->Trampolines->long_tramp; diff --git a/src/ObjCRuntime/Registrar.cs b/src/ObjCRuntime/Registrar.cs index c27d371a9c5a..150d8d20cbec 100644 --- a/src/ObjCRuntime/Registrar.cs +++ b/src/ObjCRuntime/Registrar.cs @@ -916,11 +916,7 @@ public Trampoline Trampoline { throw Registrar.CreateException (4104, Method, "The registrar cannot marshal the return value of type `{0}` in the method `{1}.{2}`.", Registrar.GetTypeFullName (NativeReturnType), Registrar.GetTypeFullName (DeclaringType.Type), Registrar.GetDescriptiveMethodName (Method)); if (is_stret) { - if (Registrar.IsSimulatorOrDesktop && !Registrar.Is64Bits) { - trampoline = is_static_trampoline ? Trampoline.X86_DoubleABI_StaticStretTrampoline : Trampoline.X86_DoubleABI_StretTrampoline; - } else { - trampoline = is_static_trampoline ? Trampoline.StaticStret : Trampoline.Stret; - } + trampoline = is_static_trampoline ? Trampoline.StaticStret : Trampoline.Stret; } else { switch (Signature [0]) { case 'Q': @@ -1151,7 +1147,6 @@ protected virtual void OnRegisterCategory (ObjCType type, ref List ex protected abstract TType GetFieldType (TField field); protected abstract int GetValueTypeSize (TType type); protected abstract bool IsSimulatorOrDesktop { get; } - protected abstract bool Is64Bits { get; } protected abstract bool IsARM64 { get; } protected abstract Exception CreateExceptionImpl (int code, bool error, Exception innerException, TMethod method, string message, params object [] args); protected abstract Exception CreateExceptionImpl (int code, bool error, Exception innerException, TType type, string message, params object [] args); @@ -2256,8 +2251,8 @@ ObjCType RegisterTypeUnsafe (TType type, ref List exceptions) DeclaringType = objcType, Name = ca.Name ?? GetPropertyName (property), #if !MTOUCH && !MMP && !BUNDLER - Size = Is64Bits ? 8 : 4, - Alignment = (byte) (Is64Bits ? 3 : 2), + Size = 8, + Alignment = (byte) 3, #endif FieldType = "@", IsProperty = true, @@ -2681,7 +2676,7 @@ protected string ToSignature (TType type, ObjCMember member, ref bool success, b switch (App.Platform) { case ApplePlatform.iOS: case ApplePlatform.TVOS: - return Is64Bits ? "B" : "c"; + return "B"; case ApplePlatform.MacOSX: case ApplePlatform.MacCatalyst: return IsARM64 ? "B" : "c"; @@ -2692,22 +2687,22 @@ protected string ToSignature (TType type, ObjCMember member, ref bool success, b #if MONOMAC || __MACCATALYST__ return IsARM64 ? "B" : "c"; #else - return Is64Bits ? "B" : "c"; + return "B"; #endif #endif case "System.Void": return "v"; case "System.String": return forProperty ? "@\"NSString\"" : "@"; case "System.nint": - return Is64Bits ? "q" : "i"; + return "q"; case "System.nuint": - return Is64Bits ? "Q" : "I"; + return "Q"; case "System.DateTime": throw CreateException (4102, member, Errors.MT4102, "System.DateTime", "Foundation.NSDate", member.FullName); } if (typeFullName == NFloatTypeName) - return Is64Bits ? "d" : "f"; + return "d"; if (Is (type, ObjCRuntime, "Selector")) return ":"; @@ -2729,18 +2724,7 @@ protected string ToSignature (TType type, ObjCMember member, ref bool success, b return "^v"; if (IsEnum (type, out isNativeEnum)) { - if (isNativeEnum && !Is64Bits) { - switch (GetEnumUnderlyingType (type).FullName) { - case "System.Int64": - return "i"; - case "System.UInt64": - return "I"; - default: - throw CreateException (4145, Errors.MT4145, GetTypeFullName (type)); - } - } else { - return ToSignature (GetEnumUnderlyingType (type), member, ref success); - } + return ToSignature (GetEnumUnderlyingType (type), member, ref success); } if (IsValueType (type)) @@ -2855,8 +2839,6 @@ enum Trampoline { Constructor, Long, StaticLong, - X86_DoubleABI_StaticStretTrampoline, - X86_DoubleABI_StretTrampoline, CopyWithZone1, CopyWithZone2, GetGCHandle, diff --git a/src/ObjCRuntime/Runtime.cs b/src/ObjCRuntime/Runtime.cs index 22e7c68f680a..c322f365707a 100644 --- a/src/ObjCRuntime/Runtime.cs +++ b/src/ObjCRuntime/Runtime.cs @@ -151,11 +151,9 @@ internal struct Trampolines { public IntPtr retain_tramp; public IntPtr static_tramp; public IntPtr ctor_tramp; - public IntPtr x86_double_abi_stret_tramp; public IntPtr static_fpret_single_tramp; public IntPtr static_fpret_double_tramp; public IntPtr static_stret_tramp; - public IntPtr x86_double_abi_static_stret_tramp; public IntPtr long_tramp; public IntPtr static_long_tramp; #if MONOMAC diff --git a/tools/common/StaticRegistrar.cs b/tools/common/StaticRegistrar.cs index c34860724d4d..7789761a18f7 100644 --- a/tools/common/StaticRegistrar.cs +++ b/tools/common/StaticRegistrar.cs @@ -747,7 +747,7 @@ protected override void ReportWarning (int code, string message, params object [ ErrorHelper.Show (ErrorHelper.CreateWarning (code, message, args)); } - public static int GetValueTypeSize (TypeDefinition type, bool is_64_bits) + public static int GetValueTypeSize (TypeDefinition type) { switch (type.FullName) { case "System.Char": return 2; @@ -764,15 +764,15 @@ public static int GetValueTypeSize (TypeDefinition type, bool is_64_bits) case "System.UInt64": return 8; case "System.IntPtr": case "System.nuint": - case "System.nint": return is_64_bits ? 8 : 4; + case "System.nint": return 8; default: if (type.FullName == NFloatTypeName) - return is_64_bits ? 8 : 4; + return 8; int size = 0; foreach (FieldDefinition field in type.Fields) { if (field.IsStatic) continue; - int s = GetValueTypeSize (field.FieldType.Resolve (), is_64_bits); + int s = GetValueTypeSize (field.FieldType.Resolve ()); if (s == -1) return -1; size += s; @@ -783,7 +783,7 @@ public static int GetValueTypeSize (TypeDefinition type, bool is_64_bits) protected override int GetValueTypeSize (TypeReference type) { - return GetValueTypeSize (type.Resolve (), Is64Bits); + return GetValueTypeSize (type.Resolve ()); } public override bool HasReleaseAttribute (MethodDefinition method) @@ -807,16 +807,6 @@ protected override bool IsSimulatorOrDesktop { } } - protected override bool Is64Bits { - get { - if (IsSingleAssembly) - return App.Is64Build; - - // Target can be null when mmp is run for multiple assemblies - return Target is not null ? Target.Is64Build : App.Is64Build; - } - } - protected override bool IsARM64 { get { return Application.IsArchEnabled (Target?.Abis ?? App.Abis, Xamarin.Abi.ARM64); @@ -2422,7 +2412,7 @@ void ProcessStructure (StringBuilder name, AutoIndentStringBuilder body, TypeDef case "System.UIntPtr": name.Append ('p'); body.AppendLine ("void *v{0};", size); - size += Is64Bits ? 8 : 4; + size += 8; break; default: bool found = false; @@ -3525,8 +3515,6 @@ bool TryGetReturnType (ObjCMethod method, string descriptiveMethodName, List