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
}
}
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;
}
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;
}
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;
}
Aggregations