From 56c2695df691d8071b1a138e9a170829e6491f4a Mon Sep 17 00:00:00 2001 From: Zoltan Varga Date: Sun, 11 Feb 2024 11:48:27 -0500 Subject: [PATCH] [mono][jit] Fix the alignment of stack slots used to pass HFA arguments on arm64. Vector3 was assumed to have size 16 and alignment 8, which caused problems when calling llvm compiled methods which assumed it was 12/8. Fixes https://github.com/dotnet/runtime/issues/96051. Previously, different sizes/alignment where used in the pinvoke/non-pinvoke cases, causing problems with calling llvm compiled methods which always --- src/mono/mono/mini/mini-arm64.c | 4 +++- src/tests/issues.targets | 10 ---------- 2 files changed, 3 insertions(+), 11 deletions(-) diff --git a/src/mono/mono/mini/mini-arm64.c b/src/mono/mono/mini/mini-arm64.c index 657aac2c79d8a..7eeaaaa4079f2 100644 --- a/src/mono/mono/mini/mini-arm64.c +++ b/src/mono/mono/mini/mini-arm64.c @@ -1662,6 +1662,8 @@ add_valuetype (CallInfo *cinfo, ArgInfo *ainfo, MonoType *t, gboolean is_return) nregs = align_size / 8; if (is_hfa (t, &nfields, &esize, field_offsets)) { + /* Use pinvoke size/alignment */ + size = mini_type_stack_size_full (t, &align, TRUE); /* * The struct might include nested float structs aligned at 8, * so need to keep track of the offsets of the individual fields. @@ -1678,7 +1680,7 @@ add_valuetype (CallInfo *cinfo, ArgInfo *ainfo, MonoType *t, gboolean is_return) } else { ainfo->nfregs_to_skip = FP_PARAM_REGS > cinfo->fr ? FP_PARAM_REGS - cinfo->fr : 0; cinfo->fr = FP_PARAM_REGS; - if (!(ios_abi && cinfo->pinvoke)) + if (!ios_abi) size = ALIGN_TO (size, 8); ainfo->storage = ArgVtypeOnStack; cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, align); diff --git a/src/tests/issues.targets b/src/tests/issues.targets index 1cdd995ac8fa8..2cbe5326fd1aa 100644 --- a/src/tests/issues.targets +++ b/src/tests/issues.targets @@ -2749,16 +2749,6 @@ - - - - https://github.com/dotnet/runtime/issues/96051 - - - https://github.com/dotnet/runtime/issues/96051 - - - https://github.com/dotnet/runtime/issues/75756