Search in sources :

Example 51 with U32

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;
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) U32(com.ibm.j9ddr.vm29.types.U32) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) J9ObjectFieldOffset(com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset) J9UTF8Pointer(com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)

Aggregations

U32 (com.ibm.j9ddr.vm29.types.U32)44 UDATA (com.ibm.j9ddr.vm29.types.UDATA)16 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)9 CorruptDataException (com.ibm.j9ddr.CorruptDataException)6 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)6 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)6 J9ROMFieldShapePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMFieldShapePointer)6 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)5 J9UTF8Pointer (com.ibm.j9ddr.vm29.pointer.generated.J9UTF8Pointer)5 OMRMemCategoryPointer (com.ibm.j9ddr.vm29.pointer.generated.OMRMemCategoryPointer)4 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)3 J9ArrayClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ArrayClassPointer)3 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)3 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)3 J9ROMNameAndSignaturePointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMNameAndSignaturePointer)3 U16 (com.ibm.j9ddr.vm29.types.U16)3 U8 (com.ibm.j9ddr.vm29.types.U8)3 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)2 J9ROMFieldShapeIterator (com.ibm.j9ddr.vm29.j9.J9ROMFieldShapeIterator)2 SelfRelativePointer (com.ibm.j9ddr.vm29.pointer.SelfRelativePointer)2