From 13216d573d36e40d3131d6028b8beb9c05aad383 Mon Sep 17 00:00:00 2001 From: Matthew Hall Date: Wed, 9 Oct 2024 14:01:18 -0400 Subject: [PATCH] Change offset verification to check for multiple of 8 (0x7) - 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 of a multiple of 4. Signed-off-by: Matthew Hall --- runtime/compiler/z/codegen/J9CodeGenerator.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/runtime/compiler/z/codegen/J9CodeGenerator.cpp b/runtime/compiler/z/codegen/J9CodeGenerator.cpp index ca13349d986..fbeba5875d0 100644 --- a/runtime/compiler/z/codegen/J9CodeGenerator.cpp +++ b/runtime/compiler/z/codegen/J9CodeGenerator.cpp @@ -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; }