Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mono/mono.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authormonojenkins <jo.shields+jenkins@xamarin.com>2018-09-14 15:23:23 +0300
committerLudovic Henry <luhenry@microsoft.com>2018-09-14 15:23:23 +0300
commit1b18f39e46eac0c38438bc8cfdaef8a4bc8afc18 (patch)
treec8a0249e0cddb014da27546d0cd836fd72b8d10f
parente0221129db0f2e71f13bd7cc75cf7e6efd83040e (diff)
[arm64] Fix the alignment of valuetypes passed after small primitive types on IOS. (#10591)
Fixes https://github.com/xamarin/xamarin-macios/issues/4347.
-rw-r--r--mono/mini/aot-tests.cs18
-rw-r--r--mono/mini/mini-arm64.c2
2 files changed, 20 insertions, 0 deletions
diff --git a/mono/mini/aot-tests.cs b/mono/mini/aot-tests.cs
index c513eeb7a2c..c69b1c0f8b4 100644
--- a/mono/mini/aot-tests.cs
+++ b/mono/mini/aot-tests.cs
@@ -222,6 +222,24 @@ class Tests
return (int)res;
}
+ struct Struct7 {
+ public string value;
+ }
+
+ class Foo7 {
+ public static string vtypeonstack_align (string s1, string s2, string s3, string s4, string s5, string s6, string s7, string s8, bool b, Struct7 s) {
+ return s.value;
+ }
+ }
+
+ [Category ("DYNCALL")]
+ static int test_0_arm64_ios_dyncall_vtypeonstack_align () {
+ var m = typeof (Foo7).GetMethod ("vtypeonstack_align");
+
+ string s = (string)m.Invoke (null, new object [] { null, null, null, null, null, null, null, null, true, new Struct7 () { value = "ABC" } });
+ return s == "ABC" ? 0 : 1;
+ }
+
class Foo6 {
public T reg_stack_split_inner<T> (int i, int j, T l) {
return l;
diff --git a/mono/mini/mini-arm64.c b/mono/mini/mini-arm64.c
index 24a43830663..e0e9b12b018 100644
--- a/mono/mini/mini-arm64.c
+++ b/mono/mini/mini-arm64.c
@@ -1196,6 +1196,7 @@ add_valuetype (CallInfo *cinfo, ArgInfo *ainfo, MonoType *t)
cinfo->fr = FP_PARAM_REGS;
size = ALIGN_TO (size, 8);
ainfo->storage = ArgVtypeOnStack;
+ cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, align);
ainfo->offset = cinfo->stack_usage;
ainfo->size = size;
ainfo->hfa = TRUE;
@@ -1215,6 +1216,7 @@ add_valuetype (CallInfo *cinfo, ArgInfo *ainfo, MonoType *t)
if (cinfo->gr + nregs > PARAM_REGS) {
size = ALIGN_TO (size, 8);
ainfo->storage = ArgVtypeOnStack;
+ cinfo->stack_usage = ALIGN_TO (cinfo->stack_usage, align);
ainfo->offset = cinfo->stack_usage;
ainfo->size = size;
cinfo->stack_usage += size;