[RyuJIT/ARM32] Skip argTable info assignment for split struct when remorphing
authorHyeongseok Oh <hseok82.oh@samsung.com>
Thu, 1 Jun 2017 01:19:16 +0000 (10:19 +0900)
committerHyeongseok Oh <hseok82.oh@samsung.com>
Thu, 1 Jun 2017 01:46:21 +0000 (10:46 +0900)
- Skip argTable no. of register & stack slot assignment for split struct when remorphing
- Modify assertion check condition for structs morphed to GT_FIELD_LIST

src/jit/compiler.h
src/jit/morph.cpp

index d438862..0de222a 100644 (file)
@@ -1345,7 +1345,7 @@ public:
 
     void RemorphStkArg(unsigned argNum, GenTreePtr node, GenTreePtr parent, unsigned numSlots, unsigned alignment);
 
-    void SplitArg(unsigned argNum, unsigned numRegs, unsigned numSlots);
+    void SplitArg(unsigned argNum, unsigned numRegs, unsigned numSlots, bool isReMorph);
 
     void EvalToTmp(unsigned argNum, unsigned tmpNum, GenTreePtr newNode);
 
index b8c269c..e1d40b9 100644 (file)
@@ -1367,7 +1367,7 @@ void fgArgInfo::RemorphStkArg(
     nextSlotNum += numSlots;
 }
 
-void fgArgInfo::SplitArg(unsigned argNum, unsigned numRegs, unsigned numSlots)
+void fgArgInfo::SplitArg(unsigned argNum, unsigned numRegs, unsigned numSlots, bool isReMorph)
 {
     fgArgTabEntryPtr curArgTabEntry = nullptr;
     assert(argNum < argCount);
@@ -1383,9 +1383,18 @@ void fgArgInfo::SplitArg(unsigned argNum, unsigned numRegs, unsigned numSlots)
     assert(numRegs > 0);
     assert(numSlots > 0);
 
-    curArgTabEntry->isSplit  = true;
-    curArgTabEntry->numRegs  = numRegs;
-    curArgTabEntry->numSlots = numSlots;
+    if (isReMorph)
+    {
+        assert(curArgTabEntry->isSplit == true);
+        assert(curArgTabEntry->numRegs == numRegs);
+        assert(curArgTabEntry->numSlots == numSlots);
+    }
+    else
+    {
+        curArgTabEntry->isSplit  = true;
+        curArgTabEntry->numRegs  = numRegs;
+        curArgTabEntry->numSlots = numSlots;
+    }
 
     nextSlotNum += numSlots;
 }
@@ -4109,7 +4118,7 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
                             assert(varTypeIsStruct(argx));
                             unsigned numRegsPartial = size - (fltArgRegNum - MAX_FLOAT_REG_ARG);
                             assert((unsigned char)numRegsPartial == numRegsPartial);
-                            call->fgArgInfo->SplitArg(argIndex, numRegsPartial, size - numRegsPartial);
+                            call->fgArgInfo->SplitArg(argIndex, numRegsPartial, size - numRegsPartial, reMorphing);
                             fltArgRegNum = MAX_FLOAT_REG_ARG;
                         }
 #endif // _TARGET_ARM_
@@ -4138,11 +4147,11 @@ GenTreeCall* Compiler::fgMorphArgs(GenTreeCall* call)
                             NYI_ARM("Struct split between integer registers and stack");
 #endif // !LEGACY_BACKEND
                             // This indicates a partial enregistration of a struct type
-                            assert((isStructArg) || argx->OperIsCopyBlkOp() ||
-                                   (argx->gtOper == GT_COMMA && (args->gtFlags & GTF_ASG)));
+                            assert((isStructArg) || argx->OperIsFieldList() ||
+                                   argx->OperIsCopyBlkOp() || (argx->gtOper == GT_COMMA && (args->gtFlags & GTF_ASG)));
                             unsigned numRegsPartial = size - (intArgRegNum - MAX_REG_ARG);
                             assert((unsigned char)numRegsPartial == numRegsPartial);
-                            call->fgArgInfo->SplitArg(argIndex, numRegsPartial, size - numRegsPartial);
+                            call->fgArgInfo->SplitArg(argIndex, numRegsPartial, size - numRegsPartial, reMorphing);
                             intArgRegNum = MAX_REG_ARG;
                             fgPtrArgCntCur += size - numRegsPartial;
                         }