use of com.ibm.j9ddr.vm29.pointer.generated.J9PoolPuddlePointer in project openj9 by eclipse.
the class Pool_29_V0 method capacity.
@Override
public long capacity() {
long numElements = 0;
try {
J9PoolPuddleListPointer puddleList = J9PoolPuddleListPointer.cast(pool.puddleList());
J9PoolPuddlePointer walk = puddleList.nextPuddle();
while (!walk.isNull()) {
numElements += pool.elementsPerPuddle().longValue();
walk = walk.nextPuddle();
}
} catch (CorruptDataException e) {
return 0;
}
return numElements;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9PoolPuddlePointer 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.generated.J9PoolPuddlePointer in project openj9 by eclipse.
the class Pool_29_V0 method isPuddleSlotFree.
// PUDDLE_SLOT_FREE
private boolean isPuddleSlotFree(J9PoolPuddlePointer currentPuddle) throws CorruptDataException {
U32Pointer ptr = U32Pointer.cast(currentPuddle.add(1));
ptr = ptr.add(slot / 32);
long value = ptr.at(0).longValue();
int bitmask = (1 << (31 - slot % 32));
return (value & bitmask) != 0;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9PoolPuddlePointer in project openj9 by eclipse.
the class DumpAllClassloadersCommand method run.
/**
* Run method for !dumpallclassloaders extension.
*
* @param command !dumpallclassloaders
* @param args !dumpallclassloaders extension accepts no args
* @param context Context
* @param out PrintStream
* @throws DDRInteractiveCommandException
*/
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (args.length != 0) {
printUsage(out);
return;
}
try {
if (J9BuildFlags.env_data64) {
out.append("+------------------------------------------------------------------------- \n");
out.append("| ClassLoader | SharedLibraries | ClassHashTable | jniIDs Pool |\n");
out.append("| | Pool | | |\n");
out.append("| |-----------------+-----------------+-----------------| \n");
out.append("| Address | used | capacity | used | capacity | used | capacity |\n");
out.append("+-------------------+-----------------+-----------------+----------------- \n");
} else {
out.append("+----------------------------------------------------------------- \n");
out.append("|ClassLoader| SharedLibraries | ClassHashTable | jniIDs Pool |\n");
out.append("| | Pool | | |\n");
out.append("| |-----------------+-----------------+-----------------| \n");
out.append("| Address | used | capacity | used | capacity | used | capacity |\n");
out.append("+-----------+-----------------+-----------------+----------------- \n");
}
GCClassLoaderIterator iterator = GCClassLoaderIterator.from();
J9ClassLoaderPointer classLoaderPointer;
String classLoaderAddress;
long sharedLibPoolNumOfelements;
long sharedLibPoolCapacity;
long classHashTableNumOfelements;
long classHashTableCapacity;
long jniIDsPoolNumOfelements;
long jniIDsPoolCapacity;
while (iterator.hasNext()) {
classLoaderPointer = iterator.next();
classLoaderAddress = classLoaderPointer.getHexAddress();
J9PoolPointer sharedLibraries = classLoaderPointer.sharedLibraries();
if (!sharedLibraries.isNull()) {
Pool<J9PoolPuddlePointer> pool = Pool.fromJ9Pool(sharedLibraries, J9PoolPuddlePointer.class);
sharedLibPoolNumOfelements = pool.numElements();
sharedLibPoolCapacity = pool.capacity();
} else {
sharedLibPoolNumOfelements = 0;
sharedLibPoolCapacity = 0;
}
J9HashTablePointer classHashTable = classLoaderPointer.classHashTable();
if (!classHashTable.isNull()) {
if (!classHashTable.listNodePool().isNull()) {
J9PoolPointer listNodePool = classHashTable.listNodePool();
Pool<J9PoolPuddlePointer> pool = Pool.fromJ9Pool(listNodePool, J9PoolPuddlePointer.class);
classHashTableNumOfelements = pool.numElements();
classHashTableCapacity = pool.capacity();
} else {
classHashTableNumOfelements = classHashTable.numberOfNodes().longValue();
classHashTableCapacity = classHashTable.tableSize().longValue();
}
} else {
classHashTableNumOfelements = 0;
classHashTableCapacity = 0;
}
J9PoolPointer jniIDs = classLoaderPointer.jniIDs();
if (!jniIDs.isNull()) {
Pool<J9PoolPuddlePointer> pool = Pool.fromJ9Pool(jniIDs, J9PoolPuddlePointer.class);
jniIDsPoolNumOfelements = pool.numElements();
jniIDsPoolCapacity = pool.capacity();
} else {
jniIDsPoolNumOfelements = 0;
jniIDsPoolCapacity = 0;
}
String output = format(classLoaderAddress, sharedLibPoolNumOfelements, sharedLibPoolCapacity, classHashTableNumOfelements, classHashTableCapacity, jniIDsPoolNumOfelements, jniIDsPoolCapacity);
out.println(output);
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
Aggregations