From cc773b851c1177f82de7ab667e6dcc35df231bcd Mon Sep 17 00:00:00 2001 From: Aleksey Kliger Date: Thu, 25 Aug 2022 10:43:39 -0400 Subject: [PATCH] [mini] Disable passing valuetypes in SIMD registers Partially reverts https://github.com/dotnet/runtime/pull/68991 When LLVM code calls non-LLVM code it will pass arguments in SIMD registers which the non-LLVM code doesn't expect Fixes https://github.com/dotnet/runtime/issues/73454 (issue 1) --- src/mono/mono/mini/mini-amd64.c | 7 +++++++ src/mono/mono/mini/mini-arm64.c | 7 +++++++ 2 files changed, 14 insertions(+) diff --git a/src/mono/mono/mini/mini-amd64.c b/src/mono/mono/mini/mini-amd64.c index 16f6f06db84706..3f52a94732440d 100644 --- a/src/mono/mono/mini/mini-amd64.c +++ b/src/mono/mono/mini/mini-amd64.c @@ -2165,6 +2165,12 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) return linfo; } +#if 0 + /* FIXME: the non-LLVM codegen should also pass arguments in registers or + * else there could a mismatch when LLVM code calls non-LLVM code + * + * See https://github.com/dotnet/runtime/issues/73454 + */ if ((t->type == MONO_TYPE_GENERICINST) && !cfg->full_aot && !sig->pinvoke) { MonoClass *klass = mono_class_from_mono_type_internal (t); if (MONO_CLASS_IS_SIMD (cfg, klass)) { @@ -2172,6 +2178,7 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) break; } } +#endif linfo->args [i].storage = LLVMArgVtypeInReg; for (j = 0; j < 2; ++j) diff --git a/src/mono/mono/mini/mini-arm64.c b/src/mono/mono/mini/mini-arm64.c index 081e5bc151aeca..65a6bb42e1fc7e 100644 --- a/src/mono/mono/mini/mini-arm64.c +++ b/src/mono/mono/mini/mini-arm64.c @@ -2521,6 +2521,12 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) break; } case ArgVtypeInIRegs: +#if 0 + /* FIXME: the non-LLVM codegen should also pass arguments in registers or + * else there could a mismatch when LLVM code calls non-LLVM code + * + * See https://github.com/dotnet/runtime/issues/73454 + */ if ((t->type == MONO_TYPE_GENERICINST) && !cfg->full_aot && !sig->pinvoke) { MonoClass *klass = mono_class_from_mono_type_internal (t); if (MONO_CLASS_IS_SIMD (cfg, klass)) { @@ -2528,6 +2534,7 @@ mono_arch_get_llvm_call_info (MonoCompile *cfg, MonoMethodSignature *sig) break; } } +#endif lainfo->storage = LLVMArgAsIArgs; lainfo->nslots = ainfo->nregs;