use of com.ibm.j9ddr.vm29.pointer.UDATAPointer in project openj9 by eclipse.
the class Pool_29_V0 method poolPuddle_startDo.
private VoidPointer poolPuddle_startDo(J9PoolPuddlePointer currentPuddle, boolean followNextPointers) throws CorruptDataException {
UDATAPointer currAddr = null;
if (pool.isNull() || currentPuddle.isNull()) {
return null;
}
if (currentPuddle.usedElements().longValue() == 0) {
if ((currentPuddle.nextPuddle().notNull()) && followNextPointers) {
return poolPuddle_startDo(currentPuddle.nextPuddle(), followNextPointers);
} else {
return null;
}
}
while (isPuddleSlotFree(currentPuddle)) {
slot++;
}
currAddr = UDATAPointer.cast(currentPuddle.firstElementAddress().getAddress() + (elementSize * slot));
state.currentPuddle = currentPuddle;
state.lastSlot = slot;
state.leftToDo = currentPuddle.usedElements().intValue() - 1;
state.flags = 0;
if (followNextPointers) {
// TODO find out where this is set
state.flags |= POOLSTATE_FOLLOW_NEXT_POINTERS;
}
if (state.leftToDo == 0) {
if (followNextPointers) {
state.currentPuddle = state.currentPuddle.nextPuddle();
state.lastSlot = -1;
} else {
state.currentPuddle = null;
}
}
logger.fine(String.format("Next pool item 0x%016x", currAddr.getAddress()));
if (logger.isLoggable(Level.FINER)) {
logger.finer(state.toString());
}
return VoidPointer.cast(currAddr);
}
use of com.ibm.j9ddr.vm29.pointer.UDATAPointer in project openj9 by eclipse.
the class GCMixedObjectIterator_V1 method initializeDescriptionArray.
protected void initializeDescriptionArray(J9ClassPointer clazz) throws CorruptDataException {
UDATAPointer descriptionPtr = clazz.instanceDescription();
long tempDescription;
if (descriptionPtr.anyBitsIn(1)) {
// Immediate
tempDescription = descriptionPtr.getAddress() >>> 1;
initializeDescriptionArray(tempDescription, 0);
} else {
int descriptionSlot = 0;
int descriptionIndex = 0;
while (descriptionIndex < scanLimit) {
tempDescription = descriptionPtr.at(descriptionSlot++).longValue();
initializeDescriptionArray(tempDescription, descriptionIndex);
descriptionIndex += objectsInDescriptionSlot;
}
}
}
use of com.ibm.j9ddr.vm29.pointer.UDATAPointer 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.pointer.UDATAPointer 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.pointer.UDATAPointer in project openj9 by eclipse.
the class RamClassWalker method allSlotsInVTableDo.
private void allSlotsInVTableDo() throws CorruptDataException {
UDATAPointer vTable = J9ClassHelper.vTable(ramClass);
final long vTableSlots = Math.max(1, vTable.at(0).longValue());
classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, vTable, "VTable size");
for (int i = 1; i < vTableSlots; i++) {
/*
* The first method is a magic method. It's enough of a j9method to
* be able to run the resolve code for unresolved virtual references
* it doesn't have a rom method associated with it, so there's no
* name, etc. The only information about that method is the methodRunAddress.
*/
classWalkerCallback.addSlot(clazz, SlotType.J9_UDATA, vTable.add(i), ((i == 1) ? "magic " : "") + "method", "!j9method");
}
classWalkerCallback.addSection(clazz, ramClass.add(1), vTableSlots * UDATA.SIZEOF, "vTable", true);
}
Aggregations