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;
}
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;
}
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);
}
}
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;
}
}
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;
}
}
Aggregations