use of com.ibm.j9ddr.vm29.pointer.ObjectReferencePointer in project openj9 by eclipse.
the class GCArrayletObjectModelBase_V1 method getElementAddress.
@Override
public VoidPointer getElementAddress(J9IndexableObjectPointer array, int elementIndex, int elementSize) throws CorruptDataException {
boolean isInlineContiguous = isInlineContiguousArraylet(array);
UDATA byteOffsetIntoData = new UDATA(elementIndex * (long) elementSize);
if (isInlineContiguous) {
return VoidPointer.cast(getDataPointerForContiguous(array).addOffset(byteOffsetIntoData));
} else {
ObjectReferencePointer arrayoid = getArrayoidPointer(array);
UDATA arrayletIndex = byteOffsetIntoData.rightShift(arrayletLeafLogSize);
VoidPointer arrayletLeafBaseAddress = VoidPointer.cast(arrayoid.at(arrayletIndex));
if (arrayletLeafBaseAddress.isNull()) {
/* this can happen if the arraylet wasn't fully initialized */
throw new NoSuchElementException("Arraylet leaf not yet initialized");
}
UDATA indexIntoArraylet = byteOffsetIntoData.bitAnd(arrayletLeafSizeMask);
return arrayletLeafBaseAddress.addOffset(indexIntoArraylet);
}
}
use of com.ibm.j9ddr.vm29.pointer.ObjectReferencePointer in project openj9 by eclipse.
the class CheckEngine method checkSlotObjectHeap.
public int checkSlotObjectHeap(J9ObjectPointer object, ObjectReferencePointer objectIndirect, GCHeapRegionDescriptor regionDesc, J9ObjectPointer objectIndirectBase) {
if (object.isNull()) {
return J9MODRON_SLOT_ITERATOR_OK;
}
int result = checkObjectIndirect(object);
/* might the heap include dark matter? If so, ignore most errors */
if ((_cycle.getMiscFlags() & J9MODRON_GCCHK_MISC_DARKMATTER) != 0) {
/* only report a subset of errors -- the rest are expected to be found in dark matter */
switch(result) {
case J9MODRON_GCCHK_RC_OK:
case J9MODRON_GCCHK_RC_UNALIGNED:
case J9MODRON_GCCHK_RC_STACK_OBJECT:
break;
/* These errors are unlikely, but not impossible to find in dark matter.
* Leave them enabled because they can help find real corruption
*/
case J9MODRON_GCCHK_RC_NOT_FOUND:
/* can happen due to contraction */
break;
/* other errors in possible dark matter are expected, so ignore them and don't
* investigate this pointer any further
*/
default:
return J9MODRON_GCCHK_RC_OK;
}
}
boolean isIndexable = false;
boolean scavengerEnabled = false;
try {
isIndexable = ObjectModel.isIndexable(objectIndirectBase);
scavengerEnabled = GCExtensions.scavengerEnabled();
} catch (CorruptDataException e) {
// TODO : cde should be part of the error
CheckError error = new CheckError(object, _cycle, _currentCheck, "Object ", J9MODRON_GCCHK_RC_CORRUPT_DATA_EXCEPTION, _cycle.nextErrorCount());
_reporter.report(error);
return J9MODRON_SLOT_ITERATOR_UNRECOVERABLE_ERROR;
}
if (J9MODRON_GCCHK_RC_OK != result) {
String elementName = isIndexable ? "IObject " : "Object ";
CheckError error = new CheckError(objectIndirectBase, objectIndirect, _cycle, _currentCheck, elementName, result, _cycle.nextErrorCount());
_reporter.report(error);
return J9MODRON_SLOT_ITERATOR_OK;
}
if (J9BuildFlags.gc_generational) {
if (scavengerEnabled) {
GCHeapRegionDescriptor objectRegion = findRegionForPointer(object, regionDesc);
if (objectRegion == null) {
/* should be impossible, since checkObjectIndirect() already verified that the object exists */
return J9MODRON_GCCHK_RC_NOT_FOUND;
}
if (object.notNull()) {
UDATA regionType;
UDATA objectRegionType;
boolean isRemembered;
boolean isOld;
try {
regionType = regionDesc.getTypeFlags();
objectRegionType = objectRegion.getTypeFlags();
isRemembered = ObjectModel.isRemembered(objectIndirectBase);
isOld = ObjectModel.isOld(object);
} catch (CorruptDataException e) {
// TODO : cde should be part of the error
CheckError error = new CheckError(objectIndirectBase, _cycle, _currentCheck, "Object ", J9MODRON_GCCHK_RC_CORRUPT_DATA_EXCEPTION, _cycle.nextErrorCount());
_reporter.report(error);
return J9MODRON_SLOT_ITERATOR_UNRECOVERABLE_ERROR;
}
/* Old objects that point to new objects should have remembered bit ON */
if (regionType.allBitsIn(MEMORY_TYPE_OLD) && objectRegionType.allBitsIn(MEMORY_TYPE_NEW) && !isRemembered) {
String elementName = isIndexable ? "IObject " : "Object ";
CheckError error = new CheckError(objectIndirectBase, objectIndirect, _cycle, _currentCheck, elementName, J9MODRON_GCCHK_RC_NEW_POINTER_NOT_REMEMBERED, _cycle.nextErrorCount());
_reporter.report(error);
return J9MODRON_SLOT_ITERATOR_OK;
}
/* Old objects that point to objects with old bit OFF should have remembered bit ON */
if (regionType.allBitsIn(MEMORY_TYPE_OLD) && !isOld && !isRemembered) {
String elementName = isIndexable ? "IObject " : "Object ";
CheckError error = new CheckError(objectIndirectBase, objectIndirect, _cycle, _currentCheck, elementName, J9MODRON_GCCHK_RC_REMEMBERED_SET_OLD_OBJECT, _cycle.nextErrorCount());
_reporter.report(error);
return J9MODRON_SLOT_ITERATOR_OK;
}
}
}
}
return J9MODRON_SLOT_ITERATOR_OK;
}
Aggregations