ARM64: Fix GC hole for Multi-Reg Struct
authorKyungwoo Lee <kyulee@microsoft.com>
Fri, 17 Jun 2016 21:27:36 +0000 (14:27 -0700)
committerKyungwoo Lee <kyulee@microsoft.com>
Fri, 17 Jun 2016 22:04:20 +0000 (15:04 -0700)
Fixes https://github.com/dotnet/coreclr/issues/5817
When we pass struct in multi-reg, we dropped the GC info on creating
instruction.
The fix is that for GT_LCL_FLD, we enforce non-float type size while
holding the gc type.

Validate with small cutdown. And also confirmed that the gc range is
reasonable in System.Reflection.RuntimeParameterInfo.GetParameters.

src/jit/codegenarm64.cpp

index 8d22db8..b690695 100644 (file)
@@ -2616,6 +2616,8 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
             {
                 NYI("GT_LCL_FLD with TYP_STRUCT");
             }
+            emitAttr size = emitTypeSize(targetType);
+
             noway_assert(targetType != TYP_STRUCT); 
             noway_assert(targetReg != REG_NA);
 
@@ -2629,12 +2631,13 @@ CodeGen::genCodeForTreeNode(GenTreePtr treeNode)
                 }
                 else
                 {
-                    emit->emitIns_R_S(ins_Load(targetType), emitTypeSize(targetType), targetReg, varNum, offset);
+                    emit->emitIns_R_S(ins_Load(targetType), size, targetReg, varNum, offset);
                 }
             }
             else
             {
-                emit->emitIns_R_S(ins_Move_Extend(targetType, treeNode->InReg()), EA_8BYTE, targetReg, varNum, offset);
+                size = EA_SET_SIZE(size, EA_8BYTE);
+                emit->emitIns_R_S(ins_Move_Extend(targetType, treeNode->InReg()), size, targetReg, varNum, offset);
             }
             genProduceReg(treeNode);
         }