use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class GCClassLocalInterfaceIterator method nextAddress.
public VoidPointer nextAddress() {
if (hasNext()) {
try {
VoidPointer next = VoidPointer.cast(iTable.interfaceClassEA());
iTable = iTable.next();
return next;
} catch (CorruptDataException e) {
// can try to recover from this
raiseCorruptDataEvent("Error getting next item", e, false);
return null;
}
} else {
throw new NoSuchElementException("There are no more items available through this iterator");
}
}
use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class GCCardTable method cleanRange.
public void cleanRange(U8Pointer lowCard, U8Pointer highCard, GCCardCleaner cardCleaner) throws CorruptDataException {
U8Pointer thisCard = lowCard;
U8Pointer endCard = highCard;
while (thisCard.lt(endCard)) {
try {
U8 card = thisCard.at(0);
if (!card.eq(J9ModroncoreConstants.CARD_CLEAN)) {
VoidPointer lowAddress = cardAddrToHeapAddr(thisCard);
VoidPointer highAddress = lowAddress.addOffset(J9ModroncoreConstants.CARD_SIZE);
cardCleaner.clean(lowAddress, highAddress, thisCard);
}
} catch (CorruptDataException cde) {
raiseCorruptDataEvent("Corrupt Card", cde, false);
}
thisCard = thisCard.add(1);
}
}
use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class GCFinalizableObjectIterator method next.
public J9ObjectPointer next() {
try {
if (hasNext()) {
J9ObjectPointer result = J9ObjectPointer.NULL;
switch(_state) {
case state_system:
result = _currentSystemObject;
advanceToNextSystemFinalizableObject();
break;
case state_default:
result = _currentDefaultObject;
advanceToNextDefaultFinalizableObject();
break;
case state_reference:
result = _currentReferenceObject;
_currentReferenceObject = ObjectAccessBarrier.getReferenceLink(_currentReferenceObject);
break;
}
return result;
} else {
throw new NoSuchElementException("There are no more items available through this iterator");
}
} catch (CorruptDataException cde) {
// can try to recover from this
raiseCorruptDataEvent("Error getting next item", cde, false);
if (_state < state_end) {
/* The current list appears damaged. Move to the next one. */
_state++;
}
return null;
}
}
use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class GCMemoryPoolSplitAddressOrderedList method checkFreeListsImpl.
/* Validates hints and free list entries without needing additional storage for the free list entries */
@Override
public void checkFreeListsImpl() {
try {
/* Get free list and hint iterators for self */
GCFreeListHeapIterator freeEntryIterator = freeListIterator();
GCHeapLinkedFreeHeader previousFreeEntry = null;
J9ModronAllocateHintPointer hint = null;
MM_HeapLinkedFreeHeaderPointer freeEntryFromHint = null;
/* Needed to return hints in ascending order of free entry address
* Here, we convert : iterator -> list -> (sort list) -> iterator */
@SuppressWarnings("unchecked") List<J9ModronAllocateHintPointer> hints = IteratorHelpers.toList(hintIterator());
Collections.sort(hints, new Comparator<J9ModronAllocateHintPointer>() {
public int compare(J9ModronAllocateHintPointer o1, J9ModronAllocateHintPointer o2) {
try {
if (o2.heapFreeHeader().gt(o1.heapFreeHeader())) {
return -1;
} else if (o2.heapFreeHeader().eq(o1.heapFreeHeader())) {
return 0;
} else {
return 1;
}
} catch (CorruptDataException e) {
raiseCorruptDataEvent("corruption detected in allocation hints", e, false);
}
throw new UnsupportedOperationException("Unreachable");
}
});
Iterator<J9ModronAllocateHintPointer> allocHintIterator = hints.iterator();
if (allocHintIterator.hasNext()) {
hint = allocHintIterator.next();
freeEntryFromHint = hint.heapFreeHeader();
}
while (freeEntryIterator.hasNext()) {
GCHeapLinkedFreeHeader freeListEntry = freeEntryIterator.next();
/* Free List Entry(FLE) checks */
try {
/* Call the generic check from base class */
freeEntryCheck(freeListEntry, previousFreeEntry);
/* Cache the previousFreeEntry for ordering checks */
previousFreeEntry = freeListEntry;
} catch (CorruptFreeEntryException e) {
raiseCorruptDataEvent("Free list corruption detected", e, false);
} catch (CorruptDataException e) {
raiseCorruptDataEvent("Corruption detected in free entry", e, false);
}
/* Check hint is in Free List */
MM_HeapLinkedFreeHeaderPointer freeListEntryPointer = freeListEntry.getHeader();
/* null is the success condition. It indicated that the free entry from the hint was found in the pools free list.
* If we find a entry from hint that is less than current free entry in pools list, fail. */
while ((null != freeEntryFromHint) && freeEntryFromHint.lte(freeListEntryPointer)) {
if (freeEntryFromHint.lt(freeListEntryPointer)) {
throw new CorruptHintException("allocHintFreeEntryCorrupt", hint);
} else {
if (allocHintIterator.hasNext()) {
hint = allocHintIterator.next();
freeEntryFromHint = hint.heapFreeHeader();
} else {
freeEntryFromHint = null;
}
}
}
}
/* If the FLE from the hint was never found in the pools FL, it was a bogus entry */
if (null != freeEntryFromHint) {
raiseCorruptDataEvent("Hint corruption detected ", new CorruptHintException("allocHintFreeEntryCorrupt", hint), false);
}
} catch (CorruptDataException e) {
raiseCorruptDataEvent("Data corruption detected while validating freelists", e, false);
}
}
use of com.ibm.j9ddr.CorruptDataException in project openj9 by eclipse.
the class GCMixedObjectIterator_V1 method nextAddress.
public VoidPointer nextAddress() {
try {
if (hasNext()) {
if (object != null && includeClassSlot) {
includeClassSlot = false;
return VoidPointer.cast(J9ObjectHelper.clazz(object).classObjectEA());
}
VoidPointer next = VoidPointer.cast(data.add(scanIndex));
scanIndex++;
return next;
} else {
throw new NoSuchElementException("There are no more items available through this iterator");
}
} catch (CorruptDataException e) {
// can try to recover from this
raiseCorruptDataEvent("Error getting next item", e, false);
return null;
}
}
Aggregations