Search in sources :

Example 91 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.

the class CheckReporterTTY method report.

@Override
public void report(CheckError error) {
    if (!shouldReport(error)) {
        return;
    }
    try {
        /* If slot is NULL, we are not scanning the slots of an object, but looking directly at an object/class on the heap. */
        if ((error._slot != null) && (error._slot.notNull())) {
            VoidPointer slot = error._slot;
            UDATA slotValue;
            switch(error._objectType) {
                case check_type_object:
                    J9ObjectPointer fieldValue = ObjectReferencePointer.cast(slot).at(0);
                    slotValue = UDATA.cast(fieldValue);
                    break;
                case check_type_thread:
                    slotValue = UDATAPointer.cast(slot).at(0);
                    slot = error._stackLocation;
                    break;
                case check_type_unfinalized:
                    // In this case, there isn't really a "slot", only the value
                    // TODO kmt : This probably shouldn't use the object(offset) format.
                    slotValue = UDATA.cast(slot);
                    slot = VoidPointer.NULL;
                    break;
                default:
                    slotValue = UDATAPointer.cast(slot).at(0);
            }
            out.println(String.format("  <gc check (%d): %s: %s: %sslot %x(%x) -> %x: %s>", error._errorNumber, "from debugger", error._check.getCheckName(), error._elementName, error._object.getAddress(), slot.getAddress(), slotValue.longValue(), getErrorType(error._errorCode)));
        } else {
            out.println(String.format("  <gc check (%d): %s: %s: %s%x: %s>", error._errorNumber, "from debugger", error._check.getCheckName(), error._elementName, error._object.getAddress(), getErrorType(error._errorCode)));
            /* If the basic checks have been made (alignment, etc.) display header info. */
            if (error._objectType == check_type_object) {
                reportObjectHeader(error, J9ObjectPointer.cast(error._object), "");
            }
        }
    } catch (CorruptDataException cde) {
        out.println(String.format("  <gc check (%d): %s: %s: %s%x: %s>", error._errorNumber, "from debugger", error._check.getCheckName(), error._elementName, error._object.getAddress(), getErrorType(error._errorCode)));
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 92 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.

the class CheckUnfinalizedList method print.

@Override
public void print() {
    try {
        MM_UnfinalizedObjectListPointer unfinalizedObjectList = getGCExtensions().unfinalizedObjectLists();
        ScanFormatter formatter = new ScanFormatter(this, "unfinalizedObjectList");
        while (unfinalizedObjectList.notNull()) {
            formatter.section("list", unfinalizedObjectList);
            J9ObjectPointer object = unfinalizedObjectList._head();
            while (object.notNull()) {
                formatter.entry(object);
                object = ObjectAccessBarrier.getFinalizeLink(object);
            }
            formatter.endSection();
            unfinalizedObjectList = unfinalizedObjectList._nextList();
        }
        formatter.end("unfinalizedObjectList");
    } catch (CorruptDataException e) {
    // TODO: handle exception
    }
}
Also used : MM_UnfinalizedObjectListPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_UnfinalizedObjectListPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 93 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.

the class CheckUnfinalizedList method check.

@Override
public void check() {
    try {
        MM_UnfinalizedObjectListPointer unfinalizedObjectList = getGCExtensions().unfinalizedObjectLists();
        while (unfinalizedObjectList.notNull()) {
            J9ObjectPointer object = unfinalizedObjectList._head();
            while (object.notNull()) {
                if (_engine.checkSlotUnfinalizedList(object, unfinalizedObjectList) != CheckBase.J9MODRON_SLOT_ITERATOR_OK) {
                    return;
                }
                object = ObjectAccessBarrier.getFinalizeLink(object);
            }
            unfinalizedObjectList = unfinalizedObjectList._nextList();
        }
    } catch (CorruptDataException e) {
    // TODO: handle exception
    }
}
Also used : MM_UnfinalizedObjectListPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_UnfinalizedObjectListPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 94 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer in project openj9 by eclipse.

the class J9ObjectStructureFormatter method format.

@Override
public FormatWalkResult format(String type, long address, PrintStream out, Context context, List<IFieldFormatter> fieldFormatters, String[] extraArgs) {
    if (type.equalsIgnoreCase("j9object") || type.equalsIgnoreCase("j9indexableobject")) {
        J9ClassPointer clazz = null;
        J9ObjectPointer object = null;
        try {
            boolean isArray;
            String className;
            object = J9ObjectPointer.cast(address);
            clazz = J9ObjectHelper.clazz(object);
            if (clazz.isNull()) {
                out.println("<can not read RAM class address>");
                return FormatWalkResult.STOP_WALKING;
            }
            isArray = J9ClassHelper.isArrayClass(clazz);
            className = J9UTF8Helper.stringValue(clazz.romClass().className());
            U8Pointer dataStart = U8Pointer.cast(object).add(ObjectModel.getHeaderSize(object));
            if (className.equals("java/lang/String")) {
                formatStringObject(out, 0, clazz, dataStart, object);
            } else if (isArray) {
                int begin = DEFAULT_ARRAY_FORMAT_BEGIN;
                int end = DEFAULT_ARRAY_FORMAT_END;
                if (extraArgs.length > 0) {
                    begin = Integer.parseInt(extraArgs[0]);
                }
                if (extraArgs.length > 1) {
                    end = Integer.parseInt(extraArgs[1]);
                }
                formatArrayObject(out, clazz, dataStart, J9IndexableObjectPointer.cast(object), begin, end);
            } else {
                formatObject(out, clazz, dataStart, object);
            }
        } catch (MemoryFault ex2) {
            out.println("Unable to read object clazz at " + object.getHexAddress() + " (clazz = " + clazz.getHexAddress() + ")");
        } catch (CorruptDataException ex) {
            out.println("Error for ");
            ex.printStackTrace(out);
        }
        return FormatWalkResult.STOP_WALKING;
    } else {
        return FormatWalkResult.KEEP_WALKING;
    }
}
Also used : MemoryFault(com.ibm.j9ddr.corereaders.memory.MemoryFault) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 95 with J9ObjectPointer

use of com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer 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

J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)76 CorruptDataException (com.ibm.j9ddr.CorruptDataException)48 UDATA (com.ibm.j9ddr.vm29.types.UDATA)22 NoSuchElementException (java.util.NoSuchElementException)18 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)17 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)16 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)12 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)7 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)6 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)5 MarkedObject (com.ibm.j9ddr.vm29.j9.gc.GCHeapMap.MarkedObject)5 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)5 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)5 GCObjectHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator)4 GCObjectIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator)4 UDATAPointer (com.ibm.j9ddr.vm29.pointer.UDATAPointer)4 ArrayList (java.util.ArrayList)4 J9ObjectFieldOffset (com.ibm.j9ddr.vm29.j9.J9ObjectFieldOffset)3 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)3 U32Pointer (com.ibm.j9ddr.vm29.pointer.U32Pointer)3