use of com.ibm.j9ddr.vm29.types.IDATA in project openj9 by eclipse.
the class MarkMapCommand method fromBits.
protected void fromBits(String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
UDATAPointer markSlot = UDATAPointer.cast(address);
UDATAPointer base = markMap.getHeapMapBits();
UDATA maxOffset = markMap.getSlotIndexAndMask(J9ObjectPointer.cast(markMap.getHeapTop().subOffset(markMap.getObjectGrain())))[0];
maxOffset = maxOffset.add(1);
UDATAPointer top = base.add(maxOffset);
if (markSlot.gte(base) && markSlot.lte(top)) {
IDATA delta = markSlot.sub(base);
int pageSize = markMap.getPageSize(null);
// obviously not right for metronome
delta = delta.mult(pageSize);
J9ObjectPointer rangeBase = J9ObjectPointer.cast(markMap.getHeapBase().addOffset(delta));
J9ObjectPointer rangeTop = rangeBase.addOffset(pageSize);
out.format("Mark bits at %s corresponds to heap range %s -> %s\n", markSlot.getHexAddress(), rangeBase.getHexAddress(), rangeTop.getHexAddress());
} else {
out.format("Address %s is not in the mark map\n", markSlot.getHexAddress());
}
}
use of com.ibm.j9ddr.vm29.types.IDATA in project openj9 by eclipse.
the class CheckEngine method checkJ9ClassPointer.
public int checkJ9ClassPointer(J9ClassPointer clazz, boolean allowUndead) throws CorruptDataException {
// Java-ism. Need to check this first before doing compares etc.
if (clazz == null || clazz.isNull()) {
return J9MODRON_GCCHK_RC_NULL_CLASS_POINTER;
}
// Short circuit if we've recently checked this class.
int cacheIndex = (int) (clazz.longValue() % CLASS_CACHE_SIZE);
if (allowUndead && clazz.eq(_checkedClassCacheAllowUndead[cacheIndex])) {
return J9MODRON_GCCHK_RC_OK;
} else if (clazz.eq(_checkedClassCache[cacheIndex])) {
return J9MODRON_GCCHK_RC_OK;
}
if (UDATA.cast(clazz).anyBitsIn(J9MODRON_GCCHK_J9CLASS_ALIGNMENT_MASK)) {
return J9MODRON_GCCHK_RC_CLASS_POINTER_UNALIGNED;
}
J9MemorySegmentPointer segment = findSegmentForClass(clazz);
if (segment == null) {
return J9MODRON_GCCHK_RC_CLASS_NOT_FOUND;
}
if (!allowUndead) {
if ((segment.type().longValue() & MEMORY_TYPE_UNDEAD_CLASS) != 0) {
return J9MODRON_GCCHK_RC_CLASS_IS_UNDEAD;
}
}
/* Check to ensure J9Class header has the correct eyecatcher. */
int result = checkJ9ClassHeader(clazz);
if (J9MODRON_GCCHK_RC_OK != result) {
return result;
}
/* Check to ensure J9Class is not unloaded */
result = checkJ9ClassIsNotUnloaded(clazz);
if (J9MODRON_GCCHK_RC_OK != result) {
return result;
}
if ((_cycle.getCheckFlags() & J9MODRON_GCCHK_VERIFY_RANGE) != 0) {
IDATA delta = segment.heapAlloc().sub(U8Pointer.cast(clazz));
/* Basic check that there is enough room for the class header */
if (delta.lt(J9Class.SIZEOF)) {
return J9MODRON_GCCHK_RC_CLASS_INVALID_RANGE;
}
}
/* class checked out. Record it in the cache so we don't need to check it again. */
if (allowUndead) {
_checkedClassCacheAllowUndead[cacheIndex] = clazz;
} else {
_checkedClassCache[cacheIndex] = clazz;
}
return J9MODRON_GCCHK_RC_OK;
}
Aggregations