Search in sources :

Example 1 with J9ThreadAbstractMonitorPointer

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

the class SimpleRootScanner method doMonitorLookupCacheSlot.

@Override
protected void doMonitorLookupCacheSlot(J9ObjectMonitorPointer slot, ObjectMonitorReferencePointer address) {
    try {
        J9ThreadAbstractMonitorPointer monitor = J9ThreadAbstractMonitorPointer.cast(slot.monitor());
        doSlot(J9ObjectPointer.cast(monitor.userData()), VoidPointer.cast(monitor.userDataEA()));
    } catch (CorruptDataException e) {
        EventManager.raiseCorruptDataEvent("Errror accessing object slot from J9ObjectMonitorPointer: " + slot.getHexAddress(), e, false);
    }
}
Also used : CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ThreadAbstractMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadAbstractMonitorPointer)

Example 2 with J9ThreadAbstractMonitorPointer

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

Example 3 with J9ThreadAbstractMonitorPointer

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

the class CheckMonitorTable method check.

@Override
public void check() {
    try {
        GCMonitorReferenceIterator monitorReferenceIterator = GCMonitorReferenceIterator.from();
        while (monitorReferenceIterator.hasNext()) {
            J9ObjectMonitorPointer objectMonitor = monitorReferenceIterator.next();
            J9ThreadAbstractMonitorPointer monitor = J9ThreadAbstractMonitorPointer.cast(objectMonitor.monitor());
            PointerPointer slot = PointerPointer.cast(monitor.userDataEA());
            if (_engine.checkSlotPool(slot, VoidPointer.cast(monitorReferenceIterator.currentMonitorTable().getJ9HashTablePointer())) != J9MODRON_SLOT_ITERATOR_OK) {
                return;
            }
        }
    } catch (CorruptDataException e) {
    // TODO: handle exception
    }
}
Also used : PointerPointer(com.ibm.j9ddr.vm29.pointer.PointerPointer) J9ObjectMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectMonitorPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) GCMonitorReferenceIterator(com.ibm.j9ddr.vm29.j9.gc.GCMonitorReferenceIterator) J9ThreadAbstractMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadAbstractMonitorPointer)

Example 4 with J9ThreadAbstractMonitorPointer

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

the class SimpleRootScanner method doMonitorReference.

@Override
protected void doMonitorReference(J9ObjectMonitorPointer slot, VoidPointer address) {
    try {
        J9ThreadAbstractMonitorPointer monitor = J9ThreadAbstractMonitorPointer.cast(slot.monitor());
        doSlot(J9ObjectPointer.cast(monitor.userData()), VoidPointer.cast(monitor.userDataEA()));
    } catch (CorruptDataException e) {
        EventManager.raiseCorruptDataEvent("Errror accessing object slot from J9ObjectMonitorPointer: " + slot.getHexAddress(), e, false);
    }
}
Also used : CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ThreadAbstractMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadAbstractMonitorPointer)

Example 5 with J9ThreadAbstractMonitorPointer

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

the class MonitorIterator method threadPoolHasNext.

private boolean threadPoolHasNext() throws CorruptDataException {
    while ((current == null) && pool.notNull()) {
        while (index < poolSize) {
            J9ThreadMonitorPointer monitor = J9ThreadMonitorPointer.cast(poolEntries.add(index));
            index++;
            if (freeTag != monitor.count().longValue()) {
                J9ThreadAbstractMonitorPointer lock = J9ThreadAbstractMonitorPointer.cast(monitor);
                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);
                        // This check is to exclude flat object monitors. Flat object monitors are accounted for during the heap walk
                        if ((objmon == null) || !objmon.isInflated()) {
                            continue;
                        }
                        // return an object monitor
                        current = objmon;
                    }
                } else {
                    // return a system monitor
                    current = monitor;
                }
                if (log.isLoggable(Level.FINE)) {
                    log.fine(String.format("Found monitor @ 0x%016x : %s", monitor.getAddress(), monitor.name().getCStringAtOffset(0)));
                }
                return true;
            }
        }
        pool = pool.next();
        if (pool.notNull()) {
            index = 0;
            poolEntries = pool.entriesEA();
        }
    }
    return pool.notNull();
}
Also used : J9ThreadMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer) J9ThreadAbstractMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadAbstractMonitorPointer) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) ObjectMonitor(com.ibm.j9ddr.vm29.j9.ObjectMonitor)

Aggregations

J9ThreadAbstractMonitorPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadAbstractMonitorPointer)8 CorruptDataException (com.ibm.j9ddr.CorruptDataException)5 ObjectMonitor (com.ibm.j9ddr.vm29.j9.ObjectMonitor)4 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)4 J9ThreadMonitorPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer)4 GCMonitorReferenceIterator (com.ibm.j9ddr.vm29.j9.gc.GCMonitorReferenceIterator)2 J9ObjectMonitorPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectMonitorPointer)2 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1 MonitorTable (com.ibm.j9ddr.vm29.j9.MonitorTable)1 MonitorIterator (com.ibm.j9ddr.vm29.j9.walkers.MonitorIterator)1 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)1 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)1 J9ThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadPointer)1 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)1 HashMap (java.util.HashMap)1