Skip to content

Use positive condition in if check #21194

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 9 additions & 11 deletions runtime/vm/ObjectFieldInfo.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -433,18 +433,24 @@ class ObjectFieldInfo {
calculateFieldDataStart(void)
{
U_32 fieldDataStart = 0;
if (!isContendedClassLayout()) {
if (isContendedClassLayout()) {
if (TrcEnabled_Trc_VM_contendedClass) {
J9UTF8 *className = J9ROMCLASS_CLASSNAME(_romClass);
U_32 utfLength = J9UTF8_LENGTH(className);
U_8 *utfData = J9UTF8_DATA(className);
Trc_VM_contendedClass(utfLength, utfData);
}
fieldDataStart = getPaddedTrueNonContendedSize() - _objectHeaderSize;
} else {
bool doubleAlignment = (_totalDoubleCount > 0);
bool hasObjects = _totalObjectCount > 0;
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)

/* If the type has double field the doubles need to start on an 8-byte boundary. In the case of valuetypes
* there is no lockword so the super class field size will be zero. This means that valueTypes in compressedrefs
* mode with double alignment fields need to be pre-padded.
*/
doubleAlignment = (doubleAlignment || (_totalFlatFieldDoubleBytes > 0));
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */

fieldDataStart = getSuperclassFieldsSize();
if (((getSuperclassObjectSize() % OBJECT_SIZE_INCREMENT_IN_BYTES) != 0) /* superclass is not end-aligned */
&& (doubleAlignment || (!_objectCanUseBackfill && hasObjects))
Expand All @@ -464,14 +470,6 @@ class ObjectFieldInfo {
fieldDataStart += BACKFILL_SIZE;
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
}
} else {
if (TrcEnabled_Trc_VM_contendedClass) {
J9UTF8 *className = J9ROMCLASS_CLASSNAME(_romClass);
U_32 utfLength = J9UTF8_LENGTH(className);
U_8 *utfData = J9UTF8_DATA(className);
Trc_VM_contendedClass(utfLength, utfData);
}
fieldDataStart = getPaddedTrueNonContendedSize() - _objectHeaderSize;
}
return fieldDataStart;
}
Expand Down