Search in sources :

Example 21 with J9ObjectPointer

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

the class DumpStringTableCommand method getStringTableObjects.

private Set<J9ObjectPointer> getStringTableObjects() throws CorruptDataException {
    /* Use sorted set to display string table ordered by address */
    SortedSet<J9ObjectPointer> sortedSet = new TreeSet<J9ObjectPointer>(new Comparator<J9ObjectPointer>() {

        public int compare(J9ObjectPointer o1, J9ObjectPointer o2) {
            if (o1.getAddress() < o2.getAddress()) {
                return -1;
            } else if (o1.getAddress() > o2.getAddress()) {
                return 1;
            } else {
                return 0;
            }
        }
    });
    GCStringTableIterator it = GCStringTableIterator.from();
    while (it.hasNext()) {
        J9ObjectPointer next = it.next();
        sortedSet.add(next);
    }
    return sortedSet;
}
Also used : TreeSet(java.util.TreeSet) GCStringTableIterator(com.ibm.j9ddr.vm29.j9.gc.GCStringTableIterator) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 22 with J9ObjectPointer

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

the class MarkMapCommand method isMarked.

protected void isMarked(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
    try {
        long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
        J9ObjectPointer object = J9ObjectPointer.cast(address);
        MarkedObject result = markMap.queryObject(object);
        if (result != null) {
            if (result.wasRelocated()) {
                out.format("Object %s is marked and relocated to %s\n", result.object.getHexAddress(), result.relocatedObject.getHexAddress());
            } else {
                out.format("Object %s is marked\n", result.object.getHexAddress());
            }
        } else {
            out.format("Object %s is not marked\n", object.getHexAddress());
        }
    } 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)

Example 23 with J9ObjectPointer

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

the class ObjectRefsCommand method dumpLiveReferences.

private void dumpLiveReferences(J9JavaVMPointer vm, J9ObjectPointer targetObject, PrintStream out) throws CorruptDataException {
    MM_HeapRegionManagerPointer hrmPointer = MM_GCExtensionsPointer.cast(vm.gcExtensions()).heapRegionManager();
    GCHeapRegionManager heapRegionManager = GCHeapRegionManager.fromHeapRegionManager(hrmPointer);
    Table table = new Table("All Live Objects That Refer To !j9object " + targetObject.getHexAddress());
    table.row("Object");
    LiveSetWalker.walkLiveSet(new LiveReferenceVisitor(heapRegionManager, targetObject, table));
    table.render(out);
}
Also used : Table(com.ibm.j9ddr.tools.ddrinteractive.Table) MM_HeapRegionManagerPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer) GCHeapRegionManager(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionManager)

Example 24 with J9ObjectPointer

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

the class ObjectSizeInfo method scanObjects.

private void scanObjects(GCHeapRegionDescriptor region) throws CorruptDataException {
    GCObjectHeapIterator heapIterator = GCObjectHeapIterator.fromHeapRegionDescriptor(region, true, true);
    while (heapIterator.hasNext()) {
        J9ObjectPointer object = heapIterator.next();
        J9ClassPointer objClass = J9ObjectHelper.clazz(object);
        if (!objClass.isNull() && (!J9ClassHelper.isArrayClass(objClass) || includeArrays)) {
            String objClassString = J9ClassHelper.getJavaName(objClass);
            if ((null == className) || className.equals(objClassString)) {
                ClassFieldInfo cfInfo = fieldStats.get(objClassString);
                if (null == cfInfo) {
                    cfInfo = new ClassFieldInfo(objClass);
                    fieldStats.put(objClassString, cfInfo);
                }
                cfInfo.addInstance(object);
            }
        }
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) GCObjectHeapIterator(com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 25 with J9ObjectPointer

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

the class MonitorsCommand method tablePrintHelper.

/**
 * Helper to print monitor tables.
 *
 * @param filter
 * @param builder
 * @param objectMonitorPointer
 * @return
 * @throws DDRInteractiveCommandException
 */
private ObjectMonitor tablePrintHelper(FilterOptions filter, StringBuilder builder, J9ObjectMonitorPointer objectMonitorPointer) throws DDRInteractiveCommandException {
    try {
        J9ThreadMonitorPointer threadMonitorPointer = objectMonitorPointer.monitor();
        J9ThreadAbstractMonitorPointer lock = J9ThreadAbstractMonitorPointer.cast(threadMonitorPointer);
        if (lock.flags().allBitsIn(J9ThreadAbstractMonitor.J9THREAD_MONITOR_OBJECT)) {
            if (!lock.userData().eq(0)) {
                // this is an object monitor in the system monitor table
                J9ObjectPointer obj = J9ObjectPointer.cast(lock.userData());
                ObjectMonitor objMon = ObjectAccessBarrier.getMonitor(obj);
                if (null != objMon) {
                    writeObjectMonitorToBuffer(filter, objMon, builder);
                    return objMon;
                }
            }
        }
    } catch (CorruptDataException e) {
        throw new DDRInteractiveCommandException(e);
    }
    return null;
}
Also used : DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9ThreadMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ThreadAbstractMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadAbstractMonitorPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) ObjectMonitor(com.ibm.j9ddr.vm29.j9.ObjectMonitor)

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