Skip to content

Commit

Permalink
fixup! aarch64: NULL initialize dataAddr field for 0 size arrays
Browse files Browse the repository at this point in the history
  • Loading branch information
VermaSh committed Jan 3, 2025
1 parent 9c83ef2 commit 519bedd
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions runtime/compiler/aarch64/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3512,7 +3512,7 @@ J9::ARM64::TreeEvaluator::VMnewEvaluator(TR::Node *node, TR::CodeGenerator *cg)

// Clear firstDataElementReg reg if dealing with 0 size arrays
generateCompareImmInstruction(cg, node, lengthReg, 0, false);
generateCondTrg1Src2Instruction(cg(), TR::InstOpCode::cselx, node, firstDataElementReg, zeroReg, firstDataElementReg, TR::CC_EQ);
generateCondTrg1Src2Instruction(cg, TR::InstOpCode::cselx, node, firstDataElementReg, zeroReg, firstDataElementReg, TR::CC_EQ);
}
else if (!isVariableLength && node->getFirstChild()->getOpCode().isLoadConst() && node->getFirstChild()->getInt() == 0)
{
Expand Down Expand Up @@ -3543,11 +3543,11 @@ J9::ARM64::TreeEvaluator::VMnewEvaluator(TR::Node *node, TR::CodeGenerator *cg)
dataAddrSlotMR = TR::MemoryReference::createWithDisplacement(cg, resultReg, fej9->getOffsetOfContiguousDataAddrField());
generateTrg1Src1ImmInstruction(cg, TR::InstOpCode::addimmx, node, firstDataElementReg, resultReg, TR::Compiler->om.contiguousArrayHeaderSizeInBytes());

if (isVariableLength && !TR::Compiler->om.compressedOBjectReferences())
if (isVariableLength && !TR::Compiler->om.compressObjectReferences())
{
// Clear firstDataElementReg reg if dealing with variable length 0 size arrays
generateCompareImmInstruction(cg, node, lengthReg, 0, false);
generateCondTrg1Src2Instruction(cg(), TR::InstOpCode::cselx, node, offsetReg, zeroReg, offsetReg, TR::CC_EQ);
generateCondTrg1Src2Instruction(cg, TR::InstOpCode::cselx, node, offsetReg, zeroReg, offsetReg, TR::CC_EQ);
}
}
generateMemSrc1Instruction(cg, TR::InstOpCode::strimmx, node, dataAddrSlotMR, firstDataElementReg);
Expand Down

0 comments on commit 519bedd

Please sign in to comment.