Search in sources :

Example 21 with GCHeapRegionDescriptor

use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor in project openj9 by eclipse.

the class CheckObjectHeap method check.

@Override
public void check() {
    // Use iterators directly
    try {
        GCHeapRegionIterator regions = GCHeapRegionIterator.from();
        boolean midScavenge = _engine.isMidscavengeFlagSet();
        boolean isVLHGC = GCExtensions.isVLHGC();
        while (regions.hasNext()) {
            GCHeapRegionDescriptor region = GCHeapRegionDescriptor.fromHeapRegionDescriptor(regions.next());
            boolean isRegionTypeNew = region.getTypeFlags().allBitsIn(MEMORY_TYPE_NEW);
            GCObjectHeapIterator heapIterator = region.objectIterator(true, true);
            while (heapIterator.hasNext()) {
                J9ObjectPointer object = heapIterator.peek();
                if (midScavenge && (isVLHGC || isRegionTypeNew)) {
                    GCScavengerForwardedHeader scavengerForwardedHeader = GCScavengerForwardedHeader.fromJ9Object(object);
                    if (scavengerForwardedHeader.isForwardedPointer()) {
                        // forwarded pointer is discovered
                        // report it
                        _engine.reportForwardedObject(object, scavengerForwardedHeader.getForwardedObject());
                        // and skip it by advancing of iterator to the next object
                        UDATA objectSize = scavengerForwardedHeader.getObjectSize();
                        heapIterator.advance(objectSize);
                        _engine.pushPreviousObject(object);
                        continue;
                    }
                }
                int result = _engine.checkObjectHeap(object, region);
                if (result != J9MODRON_SLOT_ITERATOR_OK) {
                    break;
                }
                heapIterator.next();
                _engine.pushPreviousObject(object);
            }
        }
    } catch (CorruptDataException e) {
    // TODO: handle exception
    }
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) UDATA(com.ibm.j9ddr.vm29.types.UDATA) GCHeapRegionIterator(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator) GCObjectHeapIterator(com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator) GCScavengerForwardedHeader(com.ibm.j9ddr.vm29.j9.gc.GCScavengerForwardedHeader) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 22 with GCHeapRegionDescriptor

use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor in project openj9 by eclipse.

the class CheckEngine method regionForAddress.

// TODO kmt : this doesn't belong here
private GCHeapRegionDescriptor regionForAddress(AbstractPointer pointer) {
    try {
        if (null == _hrm) {
            MM_HeapRegionManagerPointer hrm = MM_GCExtensionsPointer.cast(_javaVM.gcExtensions()).heapRegionManager();
            _hrm = GCHeapRegionManager.fromHeapRegionManager(hrm);
        }
        return _hrm.regionDescriptorForAddress(pointer);
    } catch (CorruptDataException cde) {
    }
    return null;
}
Also used : MM_HeapRegionManagerPointer(com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 23 with GCHeapRegionDescriptor

use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor in project openj9 by eclipse.

the class CheckEngine method checkSlotRememberedSet.

public int checkSlotRememberedSet(PointerPointer objectIndirect, MM_SublistPuddlePointer puddle) {
    J9ObjectPointer object;
    try {
        object = J9ObjectPointer.cast(objectIndirect.at(0));
        if (isMidscavengeFlagSet()) {
            /* during a scavenge, some RS entries may be tagged -- remove the tag */
            if (object.anyBitsIn(DEFERRED_RS_REMOVE_FLAG)) {
                object = object.untag(DEFERRED_RS_REMOVE_FLAG);
            }
        }
        int result = checkObjectIndirect(object);
        if (J9MODRON_GCCHK_RC_OK != result) {
            CheckError error = new CheckError(puddle, objectIndirect, _cycle, _currentCheck, result, _cycle.nextErrorCount());
            _reporter.report(error);
            return J9MODRON_SLOT_ITERATOR_OK;
        }
        /* Additional checks for the remembered set */
        if (object.notNull()) {
            GCHeapRegionDescriptor objectRegion = findRegionForPointer(object, null);
            if (objectRegion == null) {
                /* shouldn't happen, since checkObjectIndirect() already verified this object */
                CheckError error = new CheckError(puddle, objectIndirect, _cycle, _currentCheck, J9MODRON_GCCHK_RC_NOT_FOUND, _cycle.nextErrorCount());
                _reporter.report(error);
                return J9MODRON_SLOT_ITERATOR_OK;
            }
            /* we shouldn't have newspace references in the remembered set */
            if (objectRegion.getTypeFlags().allBitsIn(MEMORY_TYPE_NEW)) {
                CheckError error = new CheckError(puddle, objectIndirect, _cycle, _currentCheck, J9MODRON_GCCHK_RC_REMEMBERED_SET_WRONG_SEGMENT, _cycle.nextErrorCount());
                _reporter.report(error);
                return J9MODRON_SLOT_ITERATOR_OK;
            }
            boolean skipObject = false;
            if (isScavengerBackoutFlagSet()) {
                GCScavengerForwardedHeader scavengerForwardedHeader = GCScavengerForwardedHeader.fromJ9Object(object);
                if (scavengerForwardedHeader.isReverseForwardedPointer()) {
                    /* There is no reason to check object - is gone */
                    skipObject = true;
                }
            }
            if (!skipObject) {
                /* content of Remembered Set should be Old and Remembered */
                if (!ObjectModel.isOld(object) || !ObjectModel.isRemembered(object)) {
                    CheckError error = new CheckError(puddle, objectIndirect, _cycle, _currentCheck, J9MODRON_GCCHK_RC_REMEMBERED_SET_FLAGS, _cycle.nextErrorCount());
                    _reporter.report(error);
                    _reporter.reportObjectHeader(error, object, null);
                    return J9MODRON_SLOT_ITERATOR_OK;
                }
            }
        }
    } catch (CorruptDataException e) {
        // TODO : cde should be part of the error
        CheckError error = new CheckError(puddle, objectIndirect, _cycle, _currentCheck, J9MODRON_GCCHK_RC_CORRUPT_DATA_EXCEPTION, _cycle.nextErrorCount());
        _reporter.report(error);
    }
    return J9MODRON_SLOT_ITERATOR_OK;
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) GCScavengerForwardedHeader(com.ibm.j9ddr.vm29.j9.gc.GCScavengerForwardedHeader) CorruptDataException(com.ibm.j9ddr.CorruptDataException) J9ObjectPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)

Example 24 with GCHeapRegionDescriptor

use of com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor in project openj9 by eclipse.

the class DTFJJavaHeap method toString.

@Override
public String toString() {
    if (description == null) {
        try {
            U8Pointer minBase = U8Pointer.cast(-1);
            U8Pointer maxTop = U8Pointer.cast(0);
            String name = space._name().getCStringAtOffset(0);
            Iterator<GCHeapRegionDescriptor> it = regions.iterator();
            while (it.hasNext()) {
                GCHeapRegionDescriptor region = it.next();
                U8Pointer base = U8Pointer.cast(region.getLowAddress());
                U8Pointer top = U8Pointer.cast(region.getHighAddress());
                if (base.lt(minBase)) {
                    minBase = base;
                }
                if (top.gt(maxTop)) {
                    maxTop = top;
                }
            }
            description = String.format("%s [%s, Span: 0x%08x->0x%08x, Regions: %d]", getName(), name, minBase.getAddress(), maxTop.getAddress(), regions.size());
        } catch (Throwable t) {
            J9DDRDTFJUtils.handleAsCorruptDataException(DTFJContext.getProcess(), t);
            description = super.toString();
        }
    }
    return description;
}
Also used : GCHeapRegionDescriptor(com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor) U8Pointer(com.ibm.j9ddr.vm29.pointer.U8Pointer)

Aggregations

GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)13 CorruptDataException (com.ibm.j9ddr.CorruptDataException)10 GCHeapRegionIterator (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionIterator)8 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)7 UDATA (com.ibm.j9ddr.vm29.types.UDATA)7 GCObjectHeapIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectHeapIterator)4 GCObjectIterator (com.ibm.j9ddr.vm29.j9.gc.GCObjectIterator)3 GCScavengerForwardedHeader (com.ibm.j9ddr.vm29.j9.gc.GCScavengerForwardedHeader)3 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)3 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)3 MM_HeapRegionDescriptorVLHGCPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorVLHGCPointer)3 Table (com.ibm.j9ddr.tools.ddrinteractive.Table)2 VoidPointer (com.ibm.j9ddr.vm29.pointer.VoidPointer)2 MM_AllocationContextTarokPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_AllocationContextTarokPointer)2 MM_GCExtensionsPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_GCExtensionsPointer)2 MM_HeapRegionDescriptorPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionDescriptorPointer)2 MM_HeapRegionManagerPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer)2 CorruptData (com.ibm.dtfj.image.CorruptData)1 InvalidDataTypeException (com.ibm.j9ddr.InvalidDataTypeException)1 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)1