diff --git a/compiler/aarch64/codegen/OMRTreeEvaluator.cpp b/compiler/aarch64/codegen/OMRTreeEvaluator.cpp index 7332730c994..a6052e8dea2 100644 --- a/compiler/aarch64/codegen/OMRTreeEvaluator.cpp +++ b/compiler/aarch64/codegen/OMRTreeEvaluator.cpp @@ -7576,6 +7576,11 @@ OMR::ARM64::TreeEvaluator::arraycopyEvaluator(TR::Node *node, TR::CodeGenerator srcAddrNode = node->getChild(2); dstAddrNode = node->getChild(3); lengthNode = node->getChild(4); +#if defined(OMR_GC_SPARSE_HEAP_ALLOCATION) + if (TR::Compiler->om.isOffHeapAllocationEnabled()) + // For correct card-marking calculation, the dstObjNode should be the baseObj not the dataAddrPointer + TR_ASSERT_FATAL(!dstObjNode->isDataAddrPointer(), "The dstObjNode child of arraycopy cannot be a dataAddrPointer"); +#endif /* defined(OMR_GC_SPARSE_HEAP_ALLOCATION) */ } stopUsingCopyReg1 = stopUsingCopyReg(srcObjNode, srcObjReg, cg); diff --git a/compiler/p/codegen/OMRTreeEvaluator.cpp b/compiler/p/codegen/OMRTreeEvaluator.cpp index b4a65b9f042..ec37fb5bb2e 100644 --- a/compiler/p/codegen/OMRTreeEvaluator.cpp +++ b/compiler/p/codegen/OMRTreeEvaluator.cpp @@ -5989,6 +5989,11 @@ TR::Register *OMR::Power::TreeEvaluator::arraycopyEvaluator(TR::Node *node, TR:: srcAddrNode = node->getChild(2); dstAddrNode = node->getChild(3); lengthNode = node->getChild(4); +#if defined(OMR_GC_SPARSE_HEAP_ALLOCATION) + if (TR::Compiler->om.isOffHeapAllocationEnabled()) + // For correct card-marking calculation, the dstObjNode should be the baseObj not the dataAddrPointer + TR_ASSERT_FATAL(!dstObjNode->isDataAddrPointer(), "The dstObjNode child of arraycopy cannot be a dataAddrPointer"); +#endif /* defined(OMR_GC_SPARSE_HEAP_ALLOCATION) */ } stopUsingCopyReg1 = TR::TreeEvaluator::stopUsingCopyReg(srcObjNode, srcObjReg, cg);