From c139b55cd1cbea5b0322c4a08ec7cbcf42a74cbe Mon Sep 17 00:00:00 2001 From: Bernhard Urban Date: Mon, 20 May 2019 03:09:35 -0700 Subject: [PATCH] [arm] one more attempt to fix slotsize issue on llvmonly (#14444) * [arm] one more attempt to fix slotsize issue on llvmonly Regression of https://github.com/mono/mono/pull/12992 & https://github.com/mono/mono/pull/14362 In the end, the actual fix boils down to: ```patch --- a/mono/mini/mini-arm.c +++ b/mono/mini/mini-arm.c @@ -2374,7 +2374,7 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) lainfo->nslots = ALIGN_TO (ainfo->struct_size, 8) / 8; lainfo->esize = 8; } else { - lainfo->nslots = ainfo->struct_size / sizeof (target_mgreg_t); + lainfo->nslots = ALIGN_TO (ainfo->struct_size, sizeof (target_mgreg_t)) / sizeof (target_mgreg_t); lainfo->esize = 4; } break; ``` Tested on `xamarin-macios/arm64_32-v3` branch: * mscorlib * mini * dont link * monotouch tests * and a modified version of https://github.com/mono/mono/issues/8486#issuecomment-414365860 (added larger structs too) with each device, Watch Series 3 (`armv7k`) and Watch Series 4 (`arm64_32`). I hope that is the last iteration on this. * remove arm64_32_abi --- mono/mini/mini-arm.c | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/mono/mini/mini-arm.c b/mono/mini/mini-arm.c index edfd89a1e6170..d6c4dd833fb81 100644 --- a/mono/mini/mini-arm.c +++ b/mono/mini/mini-arm.c @@ -2369,14 +2369,7 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) break; case RegTypeStructByVal: { lainfo->storage = LLVMArgAsIArgs; - int slotsize; -#ifdef TARGET_WATCHOS - /* slotsize=4 works for armv7k, however arm64_32 allows passing - * structs with sizes up to 8 bytes in a single register. */ - slotsize = arm64_32_abi ? 8 : 4; -#else - slotsize = eabi_supported && ainfo->align == 8 ? 8 : 4; -#endif + int slotsize = eabi_supported && ainfo->align == 8 ? 8 : 4; lainfo->nslots = ALIGN_TO (ainfo->struct_size, slotsize) / slotsize; lainfo->esize = slotsize; break;