Search in sources :

Example 16 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class VMConstantPool method getClass.

/**
 * Get a class from the constant pool.
 * @param index A J9VmconstantpoolConstants index into the constant pool.  Must be for a class reference.
 * @return Either the loaded class, or if its not in the constant pool, J9ClassPointer.NULL.
 * @throws CorruptDataException If the CPShape of the index is not a class.
 */
public static J9ClassPointer getClass(long index) throws CorruptDataException {
    if (_constantPool.length <= index || 0 > index) {
        throw new IndexOutOfBoundsException("Index outside of constant pool bounds");
    }
    int cpIndex = (int) index;
    long shapeDesc = ConstantPoolHelpers.J9_CP_TYPE(_cpShapeDescription, cpIndex);
    if (J9CPTYPE_CLASS != shapeDesc) {
        throw new CorruptDataException("VMConstantPool[" + index + "] CP_TYPE is not J9CPTYPE_CLASS");
    }
    J9ClassPointer classPointer = null;
    if (null != _constantPool[cpIndex]) {
        classPointer = (J9ClassPointer) _constantPool[cpIndex];
    } else {
        J9RAMConstantPoolItemPointer ramEntry = _ramCPStart.add(index);
        classPointer = J9RAMClassRefPointer.cast(ramEntry).value();
        _constantPool[cpIndex] = classPointer;
    }
    return classPointer;
}
Also used : J9RAMConstantPoolItemPointer(com.ibm.j9ddr.vm29.pointer.generated.J9RAMConstantPoolItemPointer) J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 17 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class Pool_29_V0 method capacity.

@Override
public long capacity() {
    long numElements = 0;
    try {
        J9PoolPuddleListPointer puddleList = J9PoolPuddleListPointer.cast(pool.puddleList());
        J9PoolPuddlePointer walk = puddleList.nextPuddle();
        while (!walk.isNull()) {
            numElements += pool.elementsPerPuddle().longValue();
            walk = walk.nextPuddle();
        }
    } catch (CorruptDataException e) {
        return 0;
    }
    return numElements;
}
Also used : CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9PoolPuddleListPointer(com.ibm.j9ddr.vm29.pointer.generated.J9PoolPuddleListPointer) J9PoolPuddlePointer(com.ibm.j9ddr.vm29.pointer.generated.J9PoolPuddlePointer)

Example 18 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException 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 19 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class GCClassHeapIterator method next.

public J9ClassPointer next() {
    try {
        if (hasNext()) {
            J9ClassPointer clazz = classPointer;
            classPointer = classPointer.nextClassInSegment();
            return clazz;
        } else {
            throw new NoSuchElementException("There are no more items available through this iterator");
        }
    } catch (CorruptDataException cde) {
        // can try to recover from this
        raiseCorruptDataEvent("Could not set the current class", cde, false);
        return null;
    }
}
Also used : J9ClassPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Example 20 with CorruptDataException

use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.

the class GCClassLoaderSegmentIterator method next.

public J9MemorySegmentPointer next() {
    try {
        if (hasNext()) {
            J9MemorySegmentPointer currentMemorySegment = memorySegment;
            memorySegment = memorySegment.nextSegmentInClassLoader();
            return currentMemorySegment;
        } else {
            throw new NoSuchElementException("There are no more items available through this iterator");
        }
    } catch (CorruptDataException cde) {
        // can try to recover from this
        raiseCorruptDataEvent("Error returning next segment", cde, false);
        return null;
    }
}
Also used : J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Aggregations

CorruptDataException (com.ibm.j9ddr.CorruptDataException)221 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)81 J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)46 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)41 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)33 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)30 NoSuchElementException (java.util.NoSuchElementException)28 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)25 UDATA (com.ibm.j9ddr.vm29.types.UDATA)20 PointerPointer (com.ibm.j9ddr.vm29.pointer.PointerPointer)17 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)15 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)11 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)9 J9ROMMethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMMethodPointer)9 ClassWalker (com.ibm.j9ddr.vm29.tools.ddrinteractive.ClassWalker)8 LinearDumper (com.ibm.j9ddr.vm29.tools.ddrinteractive.LinearDumper)8 PatternString (com.ibm.j9ddr.util.PatternString)7 GCVMThreadListIterator (com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator)7 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)7 J9PoolPointer (com.ibm.j9ddr.vm29.pointer.generated.J9PoolPointer)7