use of com.ibm.j9ddr.vm29.types.U32 in project openj9 by eclipse.
the class J9ObjectStructureFormatter method printJ9ObjectFields.
private void printJ9ObjectFields(PrintStream out, int tabLevel, J9ClassPointer localClazz, U8Pointer dataStart, J9ObjectPointer localObject) throws CorruptDataException {
J9ClassPointer instanceClass = localClazz;
long superclassIndex;
long depth;
J9ClassPointer previousSuperclass = J9ClassPointer.NULL;
boolean lockwordPrinted = false;
if (J9BuildFlags.thr_lockNursery) {
lockwordPrinted = false;
}
/* print individual fields */
J9UTF8Pointer classNameUTF = instanceClass.romClass().className();
padding(out, tabLevel);
out.println(String.format("struct J9Class* clazz = !j9class 0x%X // %s", localClazz.getAddress(), J9UTF8Helper.stringValue(classNameUTF)));
padding(out, tabLevel);
out.println(String.format("Object flags = %s;", J9ObjectHelper.flags(localObject).getHexValue()));
if (!J9BuildFlags.thr_lockNursery) {
UDATA lockword = J9ObjectHelper.monitor(localObject);
if (lockword != null) {
padding(out, tabLevel);
out.println(String.format("j9objectmonitor_t monitor = %s;", lockword.getHexValue()));
}
}
depth = J9ClassHelper.classDepth(instanceClass).longValue();
for (superclassIndex = 0; superclassIndex <= depth; superclassIndex++) {
J9ClassPointer superclass;
if (superclassIndex == depth) {
superclass = instanceClass;
} else {
superclass = J9ClassPointer.cast(instanceClass.superclasses().at(superclassIndex));
}
U32 flags = new U32(J9VM_FIELD_OFFSET_WALK_INCLUDE_INSTANCE | J9VM_FIELD_OFFSET_WALK_INCLUDE_HIDDEN);
Iterator<J9ObjectFieldOffset> iterator = J9ObjectFieldOffsetIterator.J9ObjectFieldOffsetIteratorFor(superclass.romClass(), instanceClass, previousSuperclass, flags);
while (iterator.hasNext()) {
J9ObjectFieldOffset result = iterator.next();
boolean printField = true;
boolean isHiddenField = result.isHidden();
if (J9BuildFlags.thr_lockNursery) {
boolean isLockword = (isHiddenField && ((result.getOffsetOrAddress().add(J9Object.SIZEOF).eq(superclass.lockOffset()))));
if (isLockword) {
/* Print the lockword field if it is indeed the lockword for this instanceClass and we haven't printed it yet. */
printField = (!lockwordPrinted && (instanceClass.lockOffset().eq(superclass.lockOffset())));
if (printField) {
lockwordPrinted = true;
}
}
}
if (printField) {
printObjectField(out, tabLevel, localClazz, dataStart, superclass, result);
out.println();
}
}
previousSuperclass = superclass;
}
}
Aggregations