use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class CheckEngine method findRegionForPointer.
private GCHeapRegionDescriptor findRegionForPointer(AbstractPointer pointer, GCHeapRegionDescriptor region) {
GCHeapRegionDescriptor regionDesc = null;
if (region != null && region.isAddressInRegion(pointer)) {
return region;
}
regionDesc = regionForAddress(pointer);
if (null != regionDesc) {
return regionDesc;
}
// TODO kmt : this is tragically slow
try {
GCHeapRegionIterator iterator = GCHeapRegionIterator.from();
while (iterator.hasNext()) {
regionDesc = GCHeapRegionDescriptor.fromHeapRegionDescriptor(iterator.next());
if (isPointerInRegion(pointer, regionDesc)) {
return regionDesc;
}
}
} catch (CorruptDataException e) {
}
return null;
}
use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class CheckEngine method checkClassHeap.
public int checkClassHeap(J9ClassPointer clazz, J9MemorySegmentPointer segment) {
int result;
/*
* Verify that this is, in fact, a class
*/
try {
result = checkJ9Class(clazz, segment, _cycle.getCheckFlags());
if (J9MODRON_GCCHK_RC_OK != result) {
CheckError error = new CheckError(clazz, _cycle, _currentCheck, "Class ", result, _cycle.nextErrorCount());
_reporter.report(error);
}
/*
* Process object slots in the class
*/
GCClassIterator classIterator = GCClassIterator.fromJ9Class(clazz);
while (classIterator.hasNext()) {
PointerPointer slotPtr = PointerPointer.cast(classIterator.nextAddress());
J9ObjectPointer object = J9ObjectPointer.cast(slotPtr.at(0));
result = checkObjectIndirect(object);
if (J9MODRON_GCCHK_RC_OK != result) {
String elementName = "";
switch(classIterator.getState()) {
case GCClassIterator.state_statics:
elementName = "static ";
break;
case GCClassIterator.state_constant_pool:
elementName = "constant ";
break;
case GCClassIterator.state_slots:
elementName = "slots ";
break;
}
CheckError error = new CheckError(clazz, slotPtr, _cycle, _currentCheck, elementName, result, _cycle.nextErrorCount());
_reporter.report(error);
return J9MODRON_SLOT_ITERATOR_OK;
}
if (GCExtensions.isStandardGC()) {
/* If the slot has its old bit OFF, the class's remembered bit should be ON */
if (object.notNull() && !ObjectModel.isOld(object)) {
if (!ObjectModel.isRemembered(clazz.classObject())) {
CheckError error = new CheckError(clazz, slotPtr, _cycle, _currentCheck, "Class ", J9MODRON_GCCHK_RC_REMEMBERED_SET_OLD_OBJECT, _cycle.nextErrorCount());
_reporter.report(error);
return J9MODRON_SLOT_ITERATOR_OK;
}
}
}
}
if (J9MODRON_GCCHK_RC_OK != checkClassStatics(clazz)) {
return J9MODRON_SLOT_ITERATOR_OK;
}
J9ClassPointer replaced = clazz.replacedClass();
if (replaced.notNull()) {
if (!J9ClassHelper.isSwappedOut(replaced)) {
CheckError error = new CheckError(clazz, clazz.replacedClassEA(), _cycle, _currentCheck, "Class ", J9MODRON_GCCHK_RC_REPLACED_CLASS_HAS_NO_HOTSWAP_FLAG, _cycle.nextErrorCount());
_reporter.report(error);
return J9MODRON_SLOT_ITERATOR_OK;
}
}
/*
* Process class slots in the class
*/
GCClassIteratorClassSlots classIteratorClassSlots = GCClassIteratorClassSlots.fromJ9Class(clazz);
while (classIteratorClassSlots.hasNext()) {
PointerPointer classSlotPtr = PointerPointer.cast(classIteratorClassSlots.nextAddress());
J9ClassPointer classSlot = J9ClassPointer.cast(classSlotPtr.at(0));
String elementName = "";
result = J9MODRON_GCCHK_RC_OK;
switch(classIteratorClassSlots.getState()) {
case GCClassIteratorClassSlots.state_constant_pool:
/* may be NULL */
if (classSlot.notNull()) {
result = checkJ9ClassPointer(classSlot);
}
elementName = "constant ";
break;
case GCClassIteratorClassSlots.state_superclasses:
/* must not be NULL */
result = checkJ9ClassPointer(classSlot);
elementName = "superclass ";
break;
case GCClassIteratorClassSlots.state_interfaces:
/* must not be NULL */
result = checkJ9ClassPointer(classSlot);
elementName = "interface ";
break;
case GCClassIteratorClassSlots.state_array_class_slots:
/* may be NULL */
if (classSlot.notNull()) {
result = checkJ9ClassPointer(classSlot);
}
elementName = "array class ";
}
if (J9MODRON_GCCHK_RC_OK != result) {
CheckError error = new CheckError(clazz, classSlotPtr, _cycle, _currentCheck, elementName, result, _cycle.nextErrorCount());
_reporter.report(error);
return J9MODRON_SLOT_ITERATOR_OK;
}
}
} catch (CorruptDataException e) {
// TODO : cde should be part of the error
CheckError error = new CheckError(clazz, _cycle, _currentCheck, "Class ", J9MODRON_GCCHK_RC_CORRUPT_DATA_EXCEPTION, _cycle.nextErrorCount());
_reporter.report(error);
}
return J9MODRON_SLOT_ITERATOR_OK;
}
use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class CheckVMThreadStacks method check.
@Override
public void check() {
try {
GCVMThreadListIterator vmThreadListIterator = GCVMThreadListIterator.from();
while (vmThreadListIterator.hasNext()) {
J9VMThreadPointer walkThread = vmThreadListIterator.next();
// GC_VMThreadStackSlotIterator::scanSlots(toScanWalkThread, toScanWalkThread, (void *)&localData, checkStackSlotIterator, false, false);
WalkState walkState = new WalkState();
walkState.walkThread = walkThread;
walkState.flags = J9_STACKWALK_ITERATE_O_SLOTS | J9_STACKWALK_DO_NOT_SNIFF_AND_WHACK | J9_STACKWALK_SKIP_INLINES;
walkState.callBacks = new BaseStackWalkerCallbacks() {
public void objectSlotWalkFunction(J9VMThreadPointer walkThread, WalkState walkState, PointerPointer objectSlot, VoidPointer stackAddress) {
_engine.checkSlotStack(objectSlot, walkThread, stackAddress);
}
};
StackWalker.walkStackFrames(walkState);
}
} catch (CorruptDataException e) {
// TODO: handle exception
}
}
use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class CheckVMThreadStacks method print.
@Override
public void print() {
try {
GCVMThreadListIterator vmThreadListIterator = GCVMThreadListIterator.from();
final ScanFormatter formatter = new ScanFormatter(this, "thread stacks");
while (vmThreadListIterator.hasNext()) {
J9VMThreadPointer walkThread = vmThreadListIterator.next();
formatter.section("thread slots", walkThread);
WalkState walkState = new WalkState();
walkState.walkThread = walkThread;
walkState.flags = J9_STACKWALK_ITERATE_O_SLOTS | J9_STACKWALK_DO_NOT_SNIFF_AND_WHACK | J9_STACKWALK_SKIP_INLINES;
walkState.callBacks = new BaseStackWalkerCallbacks() {
public void objectSlotWalkFunction(J9VMThreadPointer walkThread, WalkState walkState, PointerPointer objectSlot, VoidPointer stackAddress) {
try {
formatter.entry(objectSlot.at(0));
} catch (CorruptDataException e) {
}
}
};
StackWalker.walkStackFrames(walkState);
formatter.endSection();
formatter.section("thread stack", walkThread);
dumpStackTrace(walkThread);
formatter.endSection();
}
formatter.end("thread stacks");
} catch (CorruptDataException e) {
// TODO: handle exception
}
}
use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class CheckJNIGlobalReferences method print.
@Override
public void print() {
try {
VoidPointer globalRefs = VoidPointer.cast(getJavaVM().jniGlobalReferences());
GCJNIGlobalReferenceIterator jniGlobalReferenceIterator = GCJNIGlobalReferenceIterator.from();
ScanFormatter formatter = new ScanFormatter(this, "jniGlobalReferences", globalRefs);
while (jniGlobalReferenceIterator.hasNext()) {
J9ObjectPointer slot = jniGlobalReferenceIterator.next();
if (slot.notNull()) {
formatter.entry(slot);
}
}
formatter.end("jniGlobalReferences", globalRefs);
} catch (CorruptDataException e) {
// TODO: handle exception
}
}
Aggregations