[Linux/x86] Fix tests in case of 4-byte alignment for 64-bit types (#17829)
authorKonstantin Baladurin <k.baladurin@partner.samsung.com>
Thu, 3 May 2018 19:57:26 +0000 (22:57 +0300)
committerJan Kotas <jkotas@microsoft.com>
Thu, 3 May 2018 19:57:26 +0000 (12:57 -0700)
JIT/Directed/RVAInit/nested
JIT/Directed/RVAInit/simple
JIT/Regression/CLR-x86-JIT/V1.2-Beta1/b103058/b103058

tests/src/JIT/Directed/RVAInit/nested.il
tests/src/JIT/Directed/RVAInit/simple.il
tests/src/JIT/Regression/CLR-x86-JIT/V1.2-Beta1/b103058/b103058.cs

index fbe537a..9b52721 100644 (file)
@@ -35,6 +35,7 @@
   .field public int64 _long
   .field public unsigned int64 _ulong
   .field public float32 _float
+  .field public unsigned int32 _pad
   .field public float64 _double
 } // end of class Internal
 
@@ -42,6 +43,7 @@
        extends [mscorlib]System.ValueType
 {
   .field public unsigned int8 _byte
+  .field public unsigned int32 _pad
   .field public valuetype Internal intern
   .field public int8 _sbyte
   .field public int16 _short
 66 45 13 02 66 45 13 02 66 45 13 02 00 00 00 00
 66 45 13 02 00 00 00 00 83 00 8C 42 00 00 00 00
 E3 A5 9B C4 20 00 54 40 6F 00 39 30 22 C8 00 00
- )
\ No newline at end of file
+ )
index 83b5490..f35856f 100644 (file)
@@ -24,6 +24,7 @@
   .field public int64 _long
   .field public unsigned int64 _ulong
   .field public float32 _float
+  .field public unsigned int32 _pad
   .field public float64 _double
   .field public static valuetype Test static_test at D_1
   .method private hidebysig static char  hex(unsigned int8 v) cil managed
 .data D_1 = bytearray( DE 6F 39 30 22 C8 00 00 66 45 13 02 66 45 13 02
 66 45 13 02 00 00 00 00 66 45 13 02 00 00 00 00
 83 00 8C 42 00 00 00 00 E3 A5 9B C4 20 00 54 40
- )
\ No newline at end of file
+ )
index 0d56c46..c9639cc 100644 (file)
@@ -3,6 +3,7 @@
 // See the LICENSE file in the project root for more information.
 
 using System;
+using System.Runtime.InteropServices;
 
 internal struct VT
 {
@@ -20,13 +21,21 @@ internal unsafe class test
     private static unsafe bool CheckDoubleAlignment1(VT* p)
     {
         Console.WriteLine("Address {0}", (IntPtr)p);
-        if ((int)(long)p % sizeof(double) != 0)
+        if (RuntimeInformation.IsOSPlatform(OSPlatform.Windows) || (RuntimeInformation.ProcessArchitecture != Architecture.X86))
         {
-            Console.WriteLine("not double aligned");
-            return false;
+            if ((int)(long)p % sizeof(double) != 0)
+            {
+                Console.WriteLine("not double aligned");
+                return false;
+            }
+            else
+            {
+                return true;
+            }
         }
         else
         {
+            // Current JIT implementation doesn't use double alignment stack optimization for Linux/x86
             return true;
         }
     }