Skip to content

Commit ab165aa

Browse files
committed
Use positive condition in if check
Signed-off-by: Hang Shao <[email protected]>
1 parent 5da137c commit ab165aa

File tree

1 file changed

+9
-11
lines changed

1 file changed

+9
-11
lines changed

runtime/vm/ObjectFieldInfo.hpp

+9-11
Original file line numberDiff line numberDiff line change
@@ -433,18 +433,24 @@ class ObjectFieldInfo {
433433
calculateFieldDataStart(void)
434434
{
435435
U_32 fieldDataStart = 0;
436-
if (!isContendedClassLayout()) {
436+
if (isContendedClassLayout()) {
437+
if (TrcEnabled_Trc_VM_contendedClass) {
438+
J9UTF8 *className = J9ROMCLASS_CLASSNAME(_romClass);
439+
U_32 utfLength = J9UTF8_LENGTH(className);
440+
U_8 *utfData = J9UTF8_DATA(className);
441+
Trc_VM_contendedClass(utfLength, utfData);
442+
}
443+
fieldDataStart = getPaddedTrueNonContendedSize() - _objectHeaderSize;
444+
} else {
437445
bool doubleAlignment = (_totalDoubleCount > 0);
438446
bool hasObjects = _totalObjectCount > 0;
439447
#if defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES)
440-
441448
/* If the type has double field the doubles need to start on an 8-byte boundary. In the case of valuetypes
442449
* there is no lockword so the super class field size will be zero. This means that valueTypes in compressedrefs
443450
* mode with double alignment fields need to be pre-padded.
444451
*/
445452
doubleAlignment = (doubleAlignment || (_totalFlatFieldDoubleBytes > 0));
446453
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
447-
448454
fieldDataStart = getSuperclassFieldsSize();
449455
if (((getSuperclassObjectSize() % OBJECT_SIZE_INCREMENT_IN_BYTES) != 0) /* superclass is not end-aligned */
450456
&& (doubleAlignment || (!_objectCanUseBackfill && hasObjects))
@@ -464,14 +470,6 @@ class ObjectFieldInfo {
464470
fieldDataStart += BACKFILL_SIZE;
465471
#endif /* defined(J9VM_OPT_VALHALLA_FLATTENABLE_VALUE_TYPES) */
466472
}
467-
} else {
468-
if (TrcEnabled_Trc_VM_contendedClass) {
469-
J9UTF8 *className = J9ROMCLASS_CLASSNAME(_romClass);
470-
U_32 utfLength = J9UTF8_LENGTH(className);
471-
U_8 *utfData = J9UTF8_DATA(className);
472-
Trc_VM_contendedClass(utfLength, utfData);
473-
}
474-
fieldDataStart = getPaddedTrueNonContendedSize() - _objectHeaderSize;
475473
}
476474
return fieldDataStart;
477475
}

0 commit comments

Comments
 (0)