use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer in project openj9 by eclipse.
the class HashTable_V1 method hashTableFindNodeInTree.
private VoidPointer hashTableFindNodeInTree(J9HashTablePointer table, StructType entry, PointerPointer head) throws CorruptDataException {
J9AVLTreePointer tree = avlTreeUntag(head.at(0));
AVLTree avlTree = AVLTree.fromJ9AVLTreePointer(tree, _avlTreeComparatorFunction);
J9AVLTreeNodePointer searchResult = avlTree.search(UDATA.cast(entry));
if (searchResult.notNull()) {
return avlNodeToData(searchResult);
} else {
return VoidPointer.NULL;
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer in project openj9 by eclipse.
the class HashTable_V1 method hashTableFindNodeInList.
private VoidPointer hashTableFindNodeInList(J9HashTablePointer table, StructType entry, PointerPointer head) throws CorruptDataException {
/* Look through the list looking for the correct key */
VoidPointer node = head.at(0);
StructType currentStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
while ((!node.isNull()) && (!_equalFunctionWrapper.equal(currentStruct, entry))) {
node = nextEA(node).at(0);
currentStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
}
return VoidPointer.cast(currentStruct);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer 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);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer in project openj9 by eclipse.
the class CheckStringTable method check.
@Override
public void check() {
// TODO : wouldn't it be easier to use the iterator?
try {
MM_StringTablePointer stringTable = getGCExtensions().stringTable();
long tableCount = stringTable._tableCount().longValue();
for (long tableIndex = 0; tableIndex < tableCount; tableIndex++) {
J9HashTablePointer hashTable = J9HashTablePointer.cast(stringTable._table().at(tableIndex));
SlotIterator<PointerPointer> stringTableIterator = HashTable.fromJ9HashTable(hashTable, true, PointerPointer.class, new StringTable.StringHashFunction<PointerPointer>(), new StringTable.StringComparatorFunction<PointerPointer>()).iterator();
while (stringTableIterator.hasNext()) {
PointerPointer slot = stringTableIterator.next();
if (slot.notNull()) {
if (_engine.checkSlotPool(slot, VoidPointer.cast(hashTable)) != J9MODRON_SLOT_ITERATOR_OK) {
return;
}
}
}
}
} catch (CorruptDataException e) {
// TODO: handle exception
}
// TODO : what about the cache?
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer in project openj9 by eclipse.
the class CheckStringTable method print.
@Override
public void print() {
// TODO : wouldn't it be easier to use the iterator?
try {
MM_StringTablePointer stringTable = getGCExtensions().stringTable();
long tableCount = stringTable._tableCount().longValue();
ScanFormatter formatter = new ScanFormatter(this, "StringTable", stringTable);
for (long tableIndex = 0; tableIndex < tableCount; tableIndex++) {
J9HashTablePointer hashTablePtr = J9HashTablePointer.cast(stringTable._table().at(tableIndex));
HashTable<PointerPointer> hashTable = HashTable.fromJ9HashTable(hashTablePtr, true, PointerPointer.class, new StringTable.StringHashFunction<PointerPointer>(), new StringTable.StringComparatorFunction<PointerPointer>());
SlotIterator<PointerPointer> stringTableIterator = hashTable.iterator();
while (stringTableIterator.hasNext()) {
PointerPointer slot = stringTableIterator.next();
if (slot.notNull()) {
formatter.entry(slot.at(0));
}
}
}
formatter.end("StringTable", stringTable);
} catch (CorruptDataException e) {
// TODO: handle exception
}
// TODO : what about the cache?
}
Aggregations