Skip to content

Commit

Permalink
Merge pull request #20480 from rmnattas/oh-assert
Browse files Browse the repository at this point in the history
Assert dstObj in arraycopyEval is not a dataAddrPtr in X/Z
  • Loading branch information
zl-wang authored Dec 13, 2024
2 parents c938d77 + c191852 commit 5d9f84b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 0 deletions.
6 changes: 6 additions & 0 deletions runtime/compiler/x/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1851,6 +1851,12 @@ TR::Register *J9::X86::TreeEvaluator::arraycopyEvaluator(TR::Node *node, TR::Cod
auto dstReg = cg->evaluate(node->getChild(3));
auto sizeReg = cg->evaluate(node->getChild(4));

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

if (comp->target().is64Bit() && !TR::TreeEvaluator::getNodeIs64Bit(node->getChild(4), cg))
{
generateRegRegInstruction(TR::InstOpCode::MOVZXReg8Reg4, node, sizeReg, sizeReg, 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 @@ -14289,6 +14289,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_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_SPARSE_HEAP_ALLOCATION) */

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

Expand Down

0 comments on commit 5d9f84b

Please sign in to comment.