未验证 提交 00f921d4 编写于 作者: W Will Smith 提交者: GitHub

[JIT] Fix re-use val zero on GC tracking (#84051)

* Initial work

* Added genCodeForReuseVal

* Only create a label if the current IG is not empty
上级 4f4fed0e
......@@ -1120,6 +1120,7 @@ protected:
void genCodeForPhysReg(GenTreePhysReg* tree);
void genCodeForNullCheck(GenTreeIndir* tree);
void genCodeForCmpXchg(GenTreeCmpXchg* tree);
void genCodeForReuseVal(GenTree* treeNode);
void genAlignStackBeforeCall(GenTreePutArgStk* putArgStk);
void genAlignStackBeforeCall(GenTreeCall* call);
......
......@@ -143,9 +143,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
// setting the GTF_REUSE_REG_VAL flag.
if (treeNode->IsReuseRegVal())
{
// For now, this is only used for constant nodes.
assert(treeNode->OperIs(GT_CNS_INT, GT_CNS_DBL, GT_CNS_VEC));
JITDUMP(" TreeNode is marked ReuseReg\n");
genCodeForReuseVal(treeNode);
return;
}
......
......@@ -9442,3 +9442,30 @@ bool CodeGen::genCanOmitNormalizationForBswap16(GenTree* tree)
return (cast->gtCastType == TYP_USHORT) || (cast->gtCastType == TYP_SHORT);
}
//----------------------------------------------------------------------
// genCodeForReuseVal: Generate code for a node marked with re-using a register.
//
// Arguments:
// tree - The node marked with re-using a register
//
// Remarks:
// Generates nothing, except for when the node is a CNS_INT(0) where
// we will define a new label to propagate GC info. We want to do this
// because if the node is a CNS_INT(0) and is re-using a register,
// that register could have been used for a CNS_INT(ref null) that is GC
// tracked.
//
void CodeGen::genCodeForReuseVal(GenTree* treeNode)
{
assert(treeNode->IsReuseRegVal());
// For now, this is only used for constant nodes.
assert(treeNode->OperIs(GT_CNS_INT, GT_CNS_DBL, GT_CNS_VEC));
JITDUMP(" TreeNode is marked ReuseReg\n");
if (treeNode->IsIntegralConst(0) && GetEmitter()->emitCurIGnonEmpty())
{
genDefineTempLabel(genCreateTempLabel());
}
}
......@@ -1704,9 +1704,7 @@ void CodeGen::genCodeForTreeNode(GenTree* treeNode)
// setting the GTF_REUSE_REG_VAL flag.
if (treeNode->IsReuseRegVal())
{
// For now, this is only used for constant nodes.
assert((treeNode->OperIsConst()));
JITDUMP(" TreeNode is marked ReuseReg\n");
genCodeForReuseVal(treeNode);
return;
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册