[generator] Generate the same invoke code for Mac Catalyst like we already do for macOS. (#13513)

This makes the generated code much smaller, and also avoids calling Runtime.Arch for Mac Catalyst.

Also don't generate a dual arch-specific call unless needed (this makes the generated code *much* smaller).
This commit is contained in:
Rolf Bjarne Kvinge 2021-12-10 17:36:55 +01:00 коммит произвёл GitHub
Родитель 9a07446244
Коммит e5ace3d345
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
1 изменённых файлов: 14 добавлений и 10 удалений

Просмотреть файл

@ -4052,16 +4052,20 @@ public partial class Generator : IMemberGatherer {
bool x64_stret = Stret.X86_64NeedStret (returnType, this);
bool aligned = AttributeManager.HasAttribute<AlignAttribute> (mi);
if (CurrentPlatform == PlatformName.MacOSX) {
print ("if (global::ObjCRuntime.Runtime.IsARM64CallingConvention) {");
indent++;
GenerateInvoke (false, supercall, mi, minfo, selector, args, assign_to_temp, category_type, false);
indent--;
print ("} else {");
indent++;
GenerateInvoke (x64_stret, supercall, mi, minfo, selector, args, assign_to_temp, category_type, aligned && x64_stret);
indent--;
print ("}");
if (CurrentPlatform == PlatformName.MacOSX || CurrentPlatform == PlatformName.MacCatalyst) {
if (x64_stret) {
print ("if (global::ObjCRuntime.Runtime.IsARM64CallingConvention) {");
indent++;
GenerateInvoke (false, supercall, mi, minfo, selector, args, assign_to_temp, category_type, false);
indent--;
print ("} else {");
indent++;
GenerateInvoke (x64_stret, supercall, mi, minfo, selector, args, assign_to_temp, category_type, aligned && x64_stret);
indent--;
print ("}");
} else {
GenerateInvoke (false, supercall, mi, minfo, selector, args, assign_to_temp, category_type, false);
}
return;
}