diff --git a/runtime/compiler/p/codegen/J9TreeEvaluator.cpp b/runtime/compiler/p/codegen/J9TreeEvaluator.cpp index 0cb4919028a..42fe803a56b 100644 --- a/runtime/compiler/p/codegen/J9TreeEvaluator.cpp +++ b/runtime/compiler/p/codegen/J9TreeEvaluator.cpp @@ -6165,23 +6165,24 @@ static void genInitArrayHeader(TR::Node *node, TR::Instruction *&iCursor, bool i } // Clear padding after size field - TR::Register *zeroReg = cg->allocateRegister(); - iCursor = generateTrg1Src2Instruction(cg, TR::InstOpCode::XOR, node, zeroReg, zeroReg, zeroReg, iCursor); - if (TR::Compiler->om.compressObjectReferences()) - { - // use fej9->getOffsetOfDiscontiguousArraySizeField() + 4 - iCursor = generateMemSrc1Instruction(cg, TR::InstOpCode::stw, node, - TR::MemoryReference::createWithDisplacement(cg, resReg, fej9->getOffsetOfDiscontiguousArraySizeField() + 4, 4), - zeroReg, iCursor); - } - else + if (needZeroInit) { - // use fej9->getOffsetOfContiguousArraySizeField() + 4 - iCursor = generateMemSrc1Instruction(cg, TR::InstOpCode::stw, node, - TR::MemoryReference::createWithDisplacement(cg, resReg, fej9->getOffsetOfContiguousArraySizeField() + 4, 4), - zeroReg, iCursor); + TR_ASSERT_FATAL_WITH_NODE(node, zeroReg, "zeroReg is expected to be intialized but wasn't.\n"); + if (TR::Compiler->om.compressObjectReferences()) + { + // padding field starts at fej9->getOffsetOfDiscontiguousArraySizeField() + 4 + iCursor = generateMemSrc1Instruction(cg, TR::InstOpCode::stw, node, + TR::MemoryReference::createWithDisplacement(cg, resReg, fej9->getOffsetOfDiscontiguousArraySizeField() + 4, 4), + zeroReg, iCursor); + } + else + { + // padding field starts at fej9->getOffsetOfContiguousArraySizeField() + 4 + iCursor = generateMemSrc1Instruction(cg, TR::InstOpCode::stw, node, + TR::MemoryReference::createWithDisplacement(cg, resReg, fej9->getOffsetOfContiguousArraySizeField() + 4, 4), + zeroReg, iCursor); + } } - cg->stopUsingRegister(zeroReg); } static void genZeroInit(TR::CodeGenerator *cg, TR::Node *node, TR::Register *objectReg, int32_t headerSize, int32_t totalSize, bool useInitInfo) @@ -6541,7 +6542,7 @@ TR::Register *J9::Power::TreeEvaluator::VMnewEvaluator(TR::Node *node, TR::CodeG dataAddrSlotMR = TR::MemoryReference::createWithDisplacement(cg, offsetReg, fej9->getOffsetOfContiguousDataAddrField(), TR::Compiler->om.sizeofReferenceAddress()); // Clear firstDataElementReg reg if dealing with 0 size arrays - iCursor = generateTrg1Src1ImmInstruction(cg,TR::InstOpCode::Op_cmpdi, node, condReg, enumReg, 0, iCursor); + iCursor = generateTrg1Src1ImmInstruction(cg,TR::InstOpCode::cmpi8, node, condReg, enumReg, 0, iCursor); iCursor = generateTrg1Src3Instruction(cg, TR::InstOpCode::iseleq, node, firstDataElementReg, NULL, firstDataElementReg, condReg, iCursor); } else if (!isVariableLen && node->getFirstChild()->getOpCode().isLoadConst() && node->getFirstChild()->getInt() == 0) @@ -6579,7 +6580,7 @@ TR::Register *J9::Power::TreeEvaluator::VMnewEvaluator(TR::Node *node, TR::CodeG // Clear firstDataElementReg reg if dealing with variable len 0 size arrays if (isVariableLen && !TR::Compiler->om.compressObjectReferences()) { - iCursor = generateTrg1Src1ImmInstruction(cg,TR::InstOpCode::Op_cmpdi, node, condReg, enumReg, 0, iCursor); + iCursor = generateTrg1Src1ImmInstruction(cg,TR::InstOpCode::cmpi8, node, condReg, enumReg, 0, iCursor); iCursor = generateTrg1Src3Instruction(cg, TR::InstOpCode::iseleq, node, firstDataElementReg, NULL, firstDataElementReg, condReg, iCursor); } }