2006-11-29 Mark Mason <mason@broadcom.com>
authorMark Mason <glowingpurple@gmail.com>
Wed, 29 Nov 2006 22:49:10 +0000 (22:49 -0000)
committerMark Mason <glowingpurple@gmail.com>
Wed, 29 Nov 2006 22:49:10 +0000 (22:49 -0000)
* basic-calls.cs: additional tests for passing
structures as function arguments.

Changes contributed under MIT/X11 license.

svn path=/trunk/mono/; revision=68708

mono/mini/ChangeLog
mono/mini/basic-calls.cs

index d428814e4c9210bc69aef4aad0ff89cd9b0a551b..59a31d402eb74adcc09d517440862c794ce64b78 100644 (file)
@@ -1,3 +1,8 @@
+2006-11-29  Mark Mason  <mason@broadcom.com>
+
+       * basic-calls.cs: additional tests for passing
+       structures as function arguments.
+
 2006-11-29  Mark Mason  <mason@broadcom.com>
 
        * mini-mips.h: disable custom exception handling
index 863b6eb0274bcf95bf9eb4b91bd3809724099327..2cf98185cd9fa10795113440ce989e173267669d 100644 (file)
@@ -265,6 +265,7 @@ class Tests {
                return 0;
        }
 
+       // 64-bits, 32-bit aligned
        struct struct1 {
                public int      a;
                public int      b;
@@ -313,6 +314,63 @@ class Tests {
                return 0;
        }
 
+       // 64-bits, 64-bit aligned
+       struct struct2 {
+               public long     a;
+       };
+
+       static int check_struct2(struct2 x) {
+               if (x.a != 1)
+                       return 1;
+               return 0;
+       }
+
+       static int pass_struct2(int a, int b, int c, struct2 x) {
+               if (a != 3)
+                       return 3;
+               if (b != 4)
+                       return 4;
+               if (c != 5)
+                       return 5;
+               return check_struct2(x);
+       }
+
+       static int pass_struct2(int a, int b, struct2 x) {
+               if (a != 3)
+                       return 3;
+               if (b != 4)
+                       return 4;
+               return check_struct2(x);
+       }
+
+       static int pass_struct2(int a, struct2 x) {
+               if (a != 3)
+                       return 3;
+               return check_struct2(x);
+       }
+
+       static int pass_struct2(struct2 x) {
+               return check_struct2(x);
+       }
+
+       static int test_0_struct2_args () {
+               int r;
+               struct2 x;
+
+               x.a = 1;
+               if ((r = check_struct2(x)) != 0)
+                       return r;
+               if ((r = pass_struct2(x)) != 0)
+                       return r + 10;
+               if ((r = pass_struct2(3, x)) != 0)
+                       return r + 20;
+               if ((r = pass_struct2(3, 4, x)) != 0)
+                       return r + 30;
+               if ((r = pass_struct2(3, 4, 5, x)) != 0)
+                       return r + 40;
+               return 0;
+       }
+
        static void doit (double value, out long m) {
                m = (long) value;
        }