Skip to content

Commit

Permalink
Fix fieldAlignment check for AtomicLong on Z
Browse files Browse the repository at this point in the history
"value" field for in AtomicLong is of type "long" and therefore should
be aligned to 8-byte boundary.
checkFieldAlignmentForAtomicLong was incorrectly checking that the
offset of the field is a multiple of 4 instead of a multiple of 8.
This commit fixes that.

Closes: eclipse-openj9#20235

Signed-off-by: Matthew Hall <[email protected]>
  • Loading branch information
matthewhall2 committed Oct 18, 2024
1 parent 96ba473 commit 5fff90a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions runtime/compiler/z/codegen/J9CodeGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3267,8 +3267,8 @@ J9::Z::CodeGenerator::checkFieldAlignmentForAtomicLong()
int32_t fieldNameLen = 5;
const char * fieldSig = "J";
int32_t fieldSigLen = 1;
int32_t intOrBoolOffset = self()->fe()->getObjectHeaderSizeInBytes() + self()->fej9()->getInstanceFieldOffset(classBlock, fieldName, fieldNameLen, fieldSig, fieldSigLen);
return (intOrBoolOffset & 0x3) == 0;
int32_t longOffset = self()->fe()->getObjectHeaderSizeInBytes() + self()->fej9()->getInstanceFieldOffset(classBlock, fieldName, fieldNameLen, fieldSig, fieldSigLen);
return (longOffset & 0x7) == 0;
}


Expand Down

0 comments on commit 5fff90a

Please sign in to comment.