Skip to content

Commit

Permalink
Add not dataAddrPtr assert in arraycopyEval for dstObj
Browse files Browse the repository at this point in the history
Signed-off-by: Abdulrahman Alattas <[email protected]>
  • Loading branch information
rmnattas committed Nov 1, 2024
1 parent 1fb0961 commit f863272
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 0 deletions.
5 changes: 5 additions & 0 deletions runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4597,6 +4597,11 @@ J9::ARM64::TreeEvaluator::arraycopyEvaluator(TR::Node *node, TR::CodeGenerator *
TR::Node *srcAddrNode = node->getChild(2);
TR::Node *dstAddrNode = node->getChild(3);
TR::Node *lengthNode = node->getChild(4);
#if defined(J9VM_GC_ENABLE_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(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION) */
TR::Register *srcObjReg, *dstObjReg, *srcAddrReg, *dstAddrReg, *lengthReg;
bool stopUsingCopyReg1, stopUsingCopyReg2, stopUsingCopyReg3, stopUsingCopyReg4, stopUsingCopyReg5 = false;

Expand Down
6 changes: 6 additions & 0 deletions runtime/compiler/p/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -12815,6 +12815,12 @@ TR::Register *J9::Power::TreeEvaluator::arraycopyEvaluator(TR::Node *node, TR::C
dstAddrNode = node->getChild(3);
lengthNode = node->getChild(4);

#if defined(J9VM_GC_ENABLE_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(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION) */

// These calls evaluate the nodes and give back registers that can be clobbered if needed.
stopUsingCopyReg1 = TR::TreeEvaluator::stopUsingCopyReg(srcObjNode, srcObjReg, cg);
stopUsingCopyReg2 = TR::TreeEvaluator::stopUsingCopyReg(dstObjNode, dstObjReg, cg);
Expand Down
6 changes: 6 additions & 0 deletions runtime/compiler/z/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14110,6 +14110,12 @@ J9::Z::TreeEvaluator::referenceArraycopyEvaluator(TR::Node * node, TR::CodeGener
TR::Node* byteDstNode = node->getChild(3);
TR::Node* byteLenNode = node->getChild(4);

#if defined(J9VM_GC_ENABLE_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(!byteDstObjNode->isDataAddrPointer(), "The byteDstObjNode child of arraycopy cannot be a dataAddrPointer");
#endif /* defined(J9VM_GC_ENABLE_SPARSE_HEAP_ALLOCATION) */

TR::Register* byteSrcObjReg = cg->evaluate(byteSrcObjNode);
TR::Register* byteDstObjReg = cg->evaluate(byteDstObjNode);

Expand Down

0 comments on commit f863272

Please sign in to comment.