[RyuJIT/ARM32] JitStress=1 test: padding local variable
authorHyeongseok Oh <hseok82.oh@samsung.com>
Thu, 21 Sep 2017 07:18:30 +0000 (16:18 +0900)
committerHyeongseok Oh <hseok82.oh@samsung.com>
Thu, 21 Sep 2017 07:18:30 +0000 (16:18 +0900)
JitStress=1 test make padding offset for local variable.
On ARM32, padding value must support stack alignment.

src/jit/lclvars.cpp

index b469487..1f7d7e3 100644 (file)
@@ -7332,6 +7332,14 @@ Compiler::fgWalkResult Compiler::lvaStressLclFldCB(GenTreePtr* pTree, fgWalkData
         // Calculate padding
         unsigned padding = LCL_FLD_PADDING(lclNum);
 
+#ifdef _TARGET_ARM_
+        // We need to support alignment requirements to access memory on ARM
+        unsigned alignment = 1;
+        pComp->codeGen->InferOpSizeAlign(tree, &alignment);
+        alignment = roundUp(alignment, TARGET_POINTER_SIZE);
+        padding   = roundUp(padding, alignment);
+#endif // _TARGET_ARM_
+
         // Change the variable to a TYP_BLK
         if (varType != TYP_BLK)
         {