Skip to content

Commit

Permalink
Make gcunsafe for cpblk if it has gc pointers (#70069)
Browse files Browse the repository at this point in the history
Co-authored-by: Kunal Pathak <Kunal.Pathak@microsoft.com>
  • Loading branch information
github-actions[bot] and kunalspathak authored Jun 1, 2022
1 parent 44d8b31 commit d9675d1
Showing 1 changed file with 2 additions and 16 deletions.
18 changes: 2 additions & 16 deletions src/coreclr/jit/codegenarmarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2801,22 +2801,13 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* node)
CopyBlockUnrollHelper helper(srcOffset, dstOffset, size);
regNumber srcReg = srcAddrBaseReg;

#ifdef DEBUG
bool isSrcRegAddrAlignmentKnown = false;
bool isDstRegAddrAlignmentKnown = false;
#endif

if (srcLclNum != BAD_VAR_NUM)
{
bool fpBased;
const int baseAddr = compiler->lvaFrameAddress(srcLclNum, &fpBased);

srcReg = fpBased ? REG_FPBASE : REG_SPBASE;
helper.SetSrcOffset(baseAddr + srcOffset);

#ifdef DEBUG
isSrcRegAddrAlignmentKnown = true;
#endif
}

regNumber dstReg = dstAddrBaseReg;
Expand All @@ -2828,10 +2819,6 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* node)

dstReg = fpBased ? REG_FPBASE : REG_SPBASE;
helper.SetDstOffset(baseAddr + dstOffset);

#ifdef DEBUG
isDstRegAddrAlignmentKnown = true;
#endif
}

bool canEncodeAllLoads = true;
Expand Down Expand Up @@ -2945,8 +2932,8 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* node)
}
#endif

#ifndef JIT32_GCENCODER
if (!node->gtBlkOpGcUnsafe && ((srcOffsetAdjustment != 0) || (dstOffsetAdjustment != 0)))
if (!node->gtBlkOpGcUnsafe &&
((srcOffsetAdjustment != 0) || (dstOffsetAdjustment != 0) || (node->GetLayout()->HasGCPtr())))
{
// If node is not already marked as non-interruptible, and if are about to generate code
// that produce GC references in temporary registers not reported, then mark the block
Expand All @@ -2955,7 +2942,6 @@ void CodeGen::genCodeForCpBlkUnroll(GenTreeBlk* node)
node->gtBlkOpGcUnsafe = true;
GetEmitter()->emitDisableGC();
}
#endif

if ((srcOffsetAdjustment != 0) && (dstOffsetAdjustment != 0))
{
Expand Down

0 comments on commit d9675d1

Please sign in to comment.