Search in sources :

Example 71 with J9ObjectPointer

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

the class MarkMapCommand method fromBits.

protected void fromBits(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
    UDATAPointer markSlot = UDATAPointer.cast(address);
    UDATAPointer base = markMap.getHeapMapBits();
    UDATA maxOffset = markMap.getSlotIndexAndMask(J9ObjectPointer.cast(markMap.getHeapTop().subOffset(markMap.getObjectGrain())))[0];
    maxOffset = maxOffset.add(1);
    UDATAPointer top = base.add(maxOffset);
    if (markSlot.gte(base) && markSlot.lte(top)) {
        IDATA delta = markSlot.sub(base);
        int pageSize = markMap.getPageSize(null);
        // obviously not right for metronome
        delta = delta.mult(pageSize);
        J9ObjectPointer rangeBase = J9ObjectPointer.cast(markMap.getHeapBase().addOffset(delta));
        J9ObjectPointer rangeTop = rangeBase.addOffset(pageSize);
        out.format("Mark bits at %s corresponds to heap range %s -> %s\n", markSlot.getHexAddress(), rangeBase.getHexAddress(), rangeTop.getHexAddress());
    } else {
        out.format("Address %s is not in the mark map\n", markSlot.getHexAddress());
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) IDATA(com.ibm.j9ddr.vm29.types.IDATA) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 72 with J9ObjectPointer

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

the class RootPathCommand method objectToString.

public static String objectToString(J9ObjectPointer object) throws CorruptDataException {
    J9ClassPointer clazz = J9ObjectHelper.clazz(object);
    StringWriter buf = new StringWriter();
    String className;
    className = J9ClassHelper.getJavaName(clazz);
    if (className.equals("java/lang/Class")) {
        buf.write("class ");
        buf.write(J9ClassHelper.getJavaName(ConstantPoolHelpers.J9VM_J9CLASS_FROM_HEAPCLASS(object)));
        buf.write('@');
        buf.write(object.getHexAddress());
    } else if (className.equals("java/lang/String")) {
        buf.write('"');
        buf.write(J9ObjectHelper.stringValue(object));
        buf.write("\"@");
        buf.write(object.getHexAddress());
    } else {
        buf.write(className);
        buf.write('@');
        buf.write(object.getHexAddress());
        if (ObjectModel.isIndexable(object)) {
            buf.write(" = ");
            buf.write(J9IndexableObjectHelper.getDataAsString(J9IndexableObjectPointer.cast(object)));
        }
    }
    return buf.toString();
}
Also used : StringWriter(java.io.StringWriter) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)

Example 73 with J9ObjectPointer

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

the class SearchStringTableCommand method run.

public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        if (1 == args.length) {
            J9ObjectPointer objectPointer = J9ObjectPointer.cast(CommandUtils.parsePointer(args[0], J9BuildFlags.env_data64));
            J9ObjectPointer data = StringTable.from().search(objectPointer);
            if (data.notNull()) {
                String stringValue = J9ObjectHelper.stringValue(data);
                String hexAddr = data.formatShortInteractive();
                out.println(String.format("%s <%s>", hexAddr, stringValue));
            } else {
                out.println("Not found");
            }
        } else {
            throw new DDRInteractiveCommandException("This debug extension needs an address argument !searchstringtable <addr>");
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 74 with J9ObjectPointer

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

the class MarkMapCommand method markBits.

protected void markBits(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
        J9ObjectPointer object = J9ObjectPointer.cast(address);
        J9ObjectPointer base = J9ObjectPointer.cast(address).untag(markMap.getPageSize(object) - 1);
        J9ObjectPointer top = base.addOffset(markMap.getPageSize(object));
        MarkedObject[] result = markMap.queryRange(base, top);
        if (result.length > 0) {
            if (result[0].wasRelocated()) {
                out.format("Mark bits for the compacted range %s -> %s: !j9x %s\n", base.getHexAddress(), top.getHexAddress(), result[0].markBitsSlot.getHexAddress());
            } else {
                out.format("Mark bits for the range %s -> %s: !j9x %s\n", base.getHexAddress(), top.getHexAddress(), result[0].markBitsSlot.getHexAddress());
            }
        } else {
            /* Either outside the heap, or just nothing there */
            try {
                UDATA[] indexAndMask = markMap.getSlotIndexAndMask(base);
                UDATAPointer markBitsSlot = markMap.getHeapMapBits().add(indexAndMask[0]);
                out.format("Mark bits for the range %s -> %s: !j9x %s\n", base.getHexAddress(), top.getHexAddress(), markBitsSlot.getHexAddress());
            } catch (IllegalArgumentException ex) {
                out.format("Object %s is not in the heap\n", object.getHexAddress());
            }
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) UDATAPointer(com.ibm.j9ddr.vm29.pointer.UDATAPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) MarkedObject(com.ibm.j9ddr.vm29.j9.gc.GCHeapMap.MarkedObject) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 75 with J9ObjectPointer

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

the class MarkMapCommand method scanRange.

protected void scanRange(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        long baseAddress = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
        long topAddress = CommandUtils.parsePointer(args[2], J9BuildFlags.env_data64);
        J9ObjectPointer base = J9ObjectPointer.cast(baseAddress);
        J9ObjectPointer top = J9ObjectPointer.cast(topAddress);
        MarkedObject[] results = markMap.queryRange(base, top);
        reportResults(base, top, results, out);
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) MarkedObject(com.ibm.j9ddr.vm29.j9.gc.GCHeapMap.MarkedObject) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

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