Search in sources :

Example 31 with CorruptDataException

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

the class GCPointerArrayIterator_V1 method nextAddress.

public VoidPointer nextAddress() {
    try {
        if (hasNext()) {
            if (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)

Example 32 with CorruptDataException

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

the class GCPointerArrayletIterator_V1 method nextAddress.

public VoidPointer nextAddress() {
    VoidPointer next = null;
    try {
        if (hasNext()) {
            if (includeClassSlot) {
                includeClassSlot = false;
                next = VoidPointer.cast(J9ObjectHelper.clazz(object).classObjectEA());
            } else {
                next = indexableObjectModel.getElementAddress(J9IndexableObjectPointer.cast(object), scanIndex, (int) ObjectReferencePointer.SIZEOF);
                scanIndex++;
            }
        } 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 next;
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) NoSuchElementException(java.util.NoSuchElementException)

Example 33 with CorruptDataException

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

the class GCPointerArrayletIterator_V1 method next.

@Override
public J9ObjectPointer next() {
    J9ObjectPointer next = null;
    try {
        if (hasNext()) {
            if (includeClassSlot) {
                includeClassSlot = false;
                next = J9ObjectHelper.clazz(object).classObject();
            } else {
                VoidPointer elementAddress = indexableObjectModel.getElementAddress(J9IndexableObjectPointer.cast(object), scanIndex, (int) ObjectReferencePointer.SIZEOF);
                next = ObjectReferencePointer.cast(elementAddress).at(0);
                scanIndex++;
            }
        } 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 next;
}
Also used : VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer) NoSuchElementException(java.util.NoSuchElementException)

Example 34 with CorruptDataException

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

the class GCObjectHeapIteratorAddressOrderedList_V1 method advanceScanPointer.

protected void advanceScanPointer() {
    try {
        while (scanPtr.lt(scanPtrTop)) {
            // If there is a current object, advance past it
            if (null != currentObject) {
                if (ObjectModel.isDeadObject(currentObject)) {
                    UDATA deadObjectSize = ObjectModel.getSizeInBytesDeadObject(currentObject);
                    if (deadObjectSize.eq(0)) {
                        /* The size of a hole should not be 0 */
                        throw new CorruptDataException("Dead object at " + currentObject.getHexAddress() + " has an invalid size of 0");
                    }
                    scanPtr = scanPtr.add(deadObjectSize);
                } else {
                    scanPtr = scanPtr.add(ObjectModel.getConsumedSizeInBytesWithHeader(currentObject));
                }
                currentObject = null;
            }
            // so we need to skip check for ranges in this case
            if (scanPtr.gte(scanPtrTop)) {
                return;
            }
            // Move past any TLH regions.
            while (scanPtr.gt(excludedRanges[currentExcludedRange][1])) {
                currentExcludedRange++;
            }
            if (scanPtr.gte(excludedRanges[currentExcludedRange][0])) {
                // We're in an unused TLH region.
                // TODO : this should report as a hole
                scanPtr = U8Pointer.cast(excludedRanges[currentExcludedRange][1]);
                currentExcludedRange++;
                continue;
            }
            // Make sure we haven't run past the end
            if (scanPtr.gte(scanPtrTop)) {
                return;
            }
            // Found a candidate entity.
            currentObject = J9ObjectPointer.cast(scanPtr);
            if (!(includeLiveObjects && includeDeadObjects)) {
                // If we're filtering by type make sure this one is suitable.
                boolean isDead = ObjectModel.isDeadObject(currentObject);
                if (!includeLiveObjects && !isDead) {
                    continue;
                }
                if (!includeDeadObjects && isDead) {
                    continue;
                }
            }
            return;
        }
    } catch (CorruptDataException e) {
        // can try to recover from this
        raiseCorruptDataEvent("Error getting next item", e, false);
        currentObject = null;
        // cause iteration to cease
        scanPtr = scanPtrTop;
    }
}
Also used : UDATA(com.ibm.j9ddr.vm29.types.UDATA) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 35 with CorruptDataException

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

the class GCObjectHeapIteratorMarkMapIterator_V1 method nextImpl.

protected void nextImpl() {
    _nextObject = null;
    while ((null == _nextObject) && ((_nextSlotIndex != _topSlotIndex) || (!_markWordCache.eq(0)))) {
        while ((null == _nextObject) && (!_markWordCache.eq(0))) {
            if (_markWordCache.allBitsIn(1)) {
                // this is an object
                _nextObject = convertToObject(_nextSlotIndex - 1, _shiftCount);
            }
            _shiftCount += 1;
            _markWordCache = _markWordCache.rightShift(1);
        }
        if (null == _nextObject) {
            try {
                recacheMarkMapWord();
            } catch (CorruptDataException e) {
                raiseCorruptDataEvent("Error getting next item", e, false);
                throw new NoSuchElementException("Failed to continue reading objects from region");
            }
        }
    }
}
Also used : 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