Search in sources :

Example 21 with CorruptDataException

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");
    }
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Example 22 with CorruptDataException

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);
    }
}
Also used : U8(com.ibm.j9ddr.vm29.types.U8) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 23 with CorruptDataException

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;
    }
}
Also used : CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) NoSuchElementException(java.util.NoSuchElementException)

Example 24 with CorruptDataException

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);
    }
}
Also used : J9ModronAllocateHintPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ModronAllocateHintPointer) MM_HeapLinkedFreeHeaderPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapLinkedFreeHeaderPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 25 with CorruptDataException

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;
    }
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) 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