Skip to content

Commit

Permalink
Change offset verification to check for multiple of 8 (0x7)
Browse files Browse the repository at this point in the history
- the "value" field in AtomicLong is of type "long", so it should be
  aligned to 8-byte boundaries to be used in the atomics intrinsics.
Changed offset verification to check for a multiple of 8 instead ofa
multiple of 4.

Signed-off-by: Matthew Hall <[email protected]>
  • Loading branch information
matthewhall2 committed Oct 17, 2024
1 parent 96ba473 commit c5bab58
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 c5bab58

Please sign in to comment.