Skip to content

Commit

Permalink
Fixing wrong address elementSize calculation
Browse files Browse the repository at this point in the history
generateReportFieldAccessOutlinedInstructions incorrectly believes that when it
is run on a awrtbar/awrtbari node and compressed refs is active, it is being
passed a compressed object address to pass into a call to the VM. In reality,
it is being given an uncompressed object address and the VM is expecting an
uncompressed value. This causes a problem where a stw instruction is used to
store a 64 bit value.

This change removes the special case handling of a compressed ref value for
calculating elementSize. By default, convertTypeToSize already returns the
correct value of 8 for 64 bit (and 4 for 32 bit).

Issue: #16750
Signed-off-by: jimmyk <jimmyk@ca.ibm.com>
  • Loading branch information
IBMJimmyk committed Mar 17, 2023
1 parent c296ac9 commit bc9d396
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/compiler/p/codegen/J9TreeEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ void generateReportFieldAccessOutlinedInstructions(TR::Node *node, TR::LabelSymb
if (isWrite)
{
TR::DataType dt = node->getDataType();
int32_t elementSize = dt == TR::Address ? TR::Compiler->om.sizeofReferenceField() : TR::Symbol::convertTypeToSize(dt);
int32_t elementSize = TR::Symbol::convertTypeToSize(dt);
TR::InstOpCode::Mnemonic storeOp = getLoadOrStoreFromDataType(cg, dt, elementSize, node->getOpCode().isUnsigned(), false);
TR::SymbolReference *location = cg->allocateLocalTemp(dt);
TR::MemoryReference *valueMR = TR::MemoryReference::createWithSymRef(cg, node, location, node->getSize());
Expand Down Expand Up @@ -1263,7 +1263,7 @@ J9::Power::TreeEvaluator::generateTestAndReportFieldWatchInstructions(TR::CodeGe
generateTrg1Src1ImmInstruction(cg, TR::InstOpCode::andi_r, node, scratchReg, scratchReg, cndReg, J9ClassHasWatchedFields);
generateConditionalBranchInstruction(cg, TR::InstOpCode::bne, node, fieldReportLabel, cndReg);

generateReportOOL->swapInstructionListsWithCompilation();
generateReportOOL->swapInstructionListsWithCompilation();

generateLabelInstruction(cg, TR::InstOpCode::label, node, fieldReportLabel);
generateReportFieldAccessOutlinedInstructions(node, endLabel, dataSnippetRegister, isWrite, cg, sideEffectRegister, valueReg);
Expand Down

0 comments on commit bc9d396

Please sign in to comment.