use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class GCHeapMap method queryRange.
/**
* Query the mark map to see what objects are marked within the specified range.
* Return an array of MarkedObject records describing each entry found.
* @param base Bottom of the range to query (inclusive)
* @param top Top of the range to query (exclusive)
* @return A MarkedObject[] containing the results
* @throws CorruptDataException
*/
public MarkedObject[] queryRange(J9ObjectPointer base, J9ObjectPointer top) throws CorruptDataException {
/* Naive implementation; should work but slow */
ArrayList<MarkedObject> results = new ArrayList<MarkedObject>();
if (base.lt(_heapBase)) {
base = J9ObjectPointer.cast(_heapBase);
}
if (top.gt(_heapTop)) {
top = J9ObjectPointer.cast(_heapTop);
}
if (base.gt(top)) {
base = top;
}
J9ObjectPointer cursor = base;
while (cursor.lt(top)) {
UDATA[] indexAndMask = getSlotIndexAndMask(cursor);
UDATAPointer slot = _heapMapBits.add(indexAndMask[0]);
if (slot.at(0).bitAnd(indexAndMask[1]).gt(0)) {
results.add(new MarkedObject(cursor, slot));
}
cursor = cursor.addOffset(getObjectGrain());
}
return results.toArray(new MarkedObject[results.size()]);
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class GCMarkMapStandard method queryRange.
@Override
public MarkedObject[] queryRange(J9ObjectPointer base, J9ObjectPointer top) throws CorruptDataException {
/* Naive implementation; should work but slow -- ever more than the super.
* Add handling for compacted records in the mark map. */
ArrayList<MarkedObject> results = new ArrayList<MarkedObject>();
if (base.lt(_heapBase)) {
base = J9ObjectPointer.cast(_heapBase);
}
if (top.gt(_heapTop)) {
top = J9ObjectPointer.cast(_heapTop);
}
if (base.gt(top)) {
base = top;
}
J9ObjectPointer cursor = base;
while (cursor.lt(top)) {
UDATA heapBaseOffset = UDATA.cast(cursor).sub(UDATA.cast(_heapBase));
// pairs of UDATA, so *2
UDATA pageIndex = heapBaseOffset.div(MM_CompactScheme.sizeof_page).mult(2);
UDATA compactTableEntry_addr = _heapMapBits.at(pageIndex);
UDATA compactTableEntry_bits = _heapMapBits.at(pageIndex.add(1));
// Horribly inefficient -- recomputing relocations every single time!
if (compactTableEntry_addr.allBitsIn(3)) {
// Object has been compacted -- assuming that the pointer was the pre-compacted one
J9ObjectPointer newObject = J9ObjectPointer.cast(compactTableEntry_addr.bitAnd(~3));
UDATA bits = compactTableEntry_bits;
UDATA offset = heapBaseOffset.mod(MM_CompactScheme.sizeof_page).div(2 * MM_HeapMap.J9MODRON_HEAP_SLOTS_PER_HEAPMAP_BIT * UDATA.SIZEOF);
UDATA bitMask = new UDATA(1).leftShift(offset);
if (bits.bitAnd(bitMask).eq(bitMask)) {
long mask = 1;
int ordinal = 0;
for (int i = offset.intValue(); i > 0; i--) {
if (bits.allBitsIn(mask)) {
ordinal += 1;
}
mask <<= 1;
}
for (int i = 0; i < ordinal; i++) {
UDATA objectSize = ObjectModel.getConsumedSizeInBytesWithHeader(newObject);
newObject = newObject.addOffset(objectSize);
}
results.add(new MarkedObject(cursor, _heapMapBits.add(pageIndex), newObject));
}
cursor = cursor.addOffset(getObjectGrain() * 2);
} else {
/* Same as super */
UDATA[] indexAndMask = getSlotIndexAndMask(cursor);
UDATAPointer slot = _heapMapBits.add(indexAndMask[0]);
if (slot.at(0).bitAnd(indexAndMask[1]).gt(0)) {
results.add(new MarkedObject(cursor, slot));
}
cursor = cursor.addOffset(getObjectGrain());
}
}
return results.toArray(new MarkedObject[results.size()]);
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class GCHeapRegionDescriptor_V1 method init.
protected void init() throws CorruptDataException {
lowAddress = heapRegionDescriptor._lowAddress();
regionsInSpan = heapRegionDescriptor._regionsInSpan();
regionType = heapRegionDescriptor._regionType();
MM_MemorySubSpacePointer subSpace = heapRegionDescriptor._memorySubSpace();
if (subSpace.notNull()) {
typeFlags = subSpace._memoryType().bitOr(J9MemorySegment.MEMORY_TYPE_RAM);
} else {
typeFlags = new UDATA(0);
}
memorySubSpace = heapRegionDescriptor._memorySubSpace();
memoryPool = heapRegionDescriptor._memoryPool();
if (regionsInSpan.eq(0)) {
highAddress = heapRegionDescriptor._highAddress();
} else {
UDATA delta = UDATA.cast(heapRegionDescriptor._highAddress()).sub(UDATA.cast(lowAddress));
highAddress = lowAddress.addOffset(regionsInSpan.mult(delta));
}
MM_HeapRegionDescriptorPointer head = heapRegionDescriptor._headOfSpan();
if (head.isNull() || head.eq(heapRegionDescriptor)) {
headOfSpan = this;
} else {
headOfSpan = GCHeapRegionDescriptor.fromHeapRegionDescriptor(head);
}
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class GCMarkMapStandard method getPageSize.
@Override
public int getPageSize(J9ObjectPointer object) {
int result = super.getPageSize(object);
try {
if ((object != null) && object.gte(_heapBase) && object.lt(_heapTop)) {
UDATA heapBaseOffset = UDATA.cast(object).sub(UDATA.cast(_heapBase));
// pairs of UDATA, so *2
UDATA pageIndex = heapBaseOffset.div(MM_CompactScheme.sizeof_page).mult(2);
UDATA compactTableEntry_addr = _heapMapBits.at(pageIndex);
if (compactTableEntry_addr.allBitsIn(3)) {
result = (int) MM_CompactScheme.sizeof_page;
}
}
} catch (CorruptDataException cde) {
// Ignore this particular error -- surely the calling code will hit it
}
return result;
}
use of com.ibm.j9ddr.vm29.types.UDATA in project openj9 by eclipse.
the class GCObjectHeapIteratorAddressOrderedList_V1 method advance.
@Override
public void advance(UDATA size) {
U8Pointer newAddress = scanPtr.addOffset(size);
if (newAddress.gte(scanPtr) && newAddress.lt(scanPtrTop)) {
scanPtr = newAddress;
currentObject = null;
} else {
throw new NoSuchElementException("An address to advance is out of range");
}
}
Aggregations