Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 0 additions & 12 deletions runtime/runtime.m
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
2 changes: 0 additions & 2 deletions runtime/xamarin/trampolines.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
12 changes: 0 additions & 12 deletions src/ObjCRuntime/DynamicRegistrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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;
Expand Down
12 changes: 0 additions & 12 deletions src/ObjCRuntime/Method.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
36 changes: 9 additions & 27 deletions src/ObjCRuntime/Registrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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':
Expand Down Expand Up @@ -1151,7 +1147,6 @@ protected virtual void OnRegisterCategory (ObjCType type, ref List<Exception> 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);
Expand Down Expand Up @@ -2256,8 +2251,8 @@ ObjCType RegisterTypeUnsafe (TType type, ref List<Exception> 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,
Expand Down Expand Up @@ -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";
Expand All @@ -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 ":";
Expand All @@ -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))
Expand Down Expand Up @@ -2855,8 +2839,6 @@ enum Trampoline {
Constructor,
Long,
StaticLong,
X86_DoubleABI_StaticStretTrampoline,
X86_DoubleABI_StretTrampoline,
CopyWithZone1,
CopyWithZone2,
GetGCHandle,
Expand Down
2 changes: 0 additions & 2 deletions src/ObjCRuntime/Runtime.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
24 changes: 6 additions & 18 deletions tools/common/StaticRegistrar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand All @@ -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)
Expand All @@ -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);
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -3525,8 +3515,6 @@ bool TryGetReturnType (ObjCMethod method, string descriptiveMethodName, List<Exc
case Trampoline.StaticLong:
case Trampoline.StaticDouble:
case Trampoline.StaticSingle:
case Trampoline.X86_DoubleABI_StaticStretTrampoline:
case Trampoline.X86_DoubleABI_StretTrampoline:
case Trampoline.StaticStret:
case Trampoline.Stret:
case Trampoline.CopyWithZone2:
Expand Down