File tree 1 file changed +6
-5
lines changed
1 file changed +6
-5
lines changed Original file line number Diff line number Diff line change @@ -443,14 +443,15 @@ void Lowering::LowerBlockStore(GenTreeBlk* blkNode)
443
443
444
444
ClassLayout* layout = blkNode->GetLayout ();
445
445
bool doCpObj = layout->HasGCPtr ();
446
- unsigned copyBlockUnrollLimit = comp->getUnrollThreshold (Compiler::UnrollKind::Memcpy, false );
446
+ bool isNotHeap = blkNode->IsAddressNotOnHeap (comp);
447
+ bool canUseSimd = !doCpObj || isNotHeap;
448
+ unsigned copyBlockUnrollLimit = comp->getUnrollThreshold (Compiler::UnrollKind::Memcpy, canUseSimd);
447
449
448
450
#ifndef JIT32_GCENCODER
449
451
if (doCpObj && (size <= copyBlockUnrollLimit))
450
452
{
451
- // No write barriers are needed on the stack.
452
- // If the layout is byref-like, then we know it must live on the stack.
453
- if (blkNode->IsAddressNotOnHeap (comp))
453
+ // No write barriers are needed if the destination is known to be outside of the GC heap.
454
+ if (isNotHeap)
454
455
{
455
456
// If the size is small enough to unroll then we need to mark the block as non-interruptible
456
457
// to actually allow unrolling. The generated code does not report GC references loaded in the
@@ -515,7 +516,7 @@ void Lowering::LowerBlockStore(GenTreeBlk* blkNode)
515
516
}
516
517
}
517
518
else if (blkNode->OperIs (GT_STORE_BLK) &&
518
- (size <= comp->getUnrollThreshold (Compiler::UnrollKind::Memcpy, !layout-> HasGCPtr () )))
519
+ (size <= comp->getUnrollThreshold (Compiler::UnrollKind::Memcpy, canUseSimd )))
519
520
{
520
521
blkNode->gtBlkOpKind = GenTreeBlk::BlkOpKindUnroll;
521
522
You can’t perform that action at this time.
0 commit comments