use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer in project openj9 by eclipse.
the class HashTable_V1 method hashTableFindNodeSpaceOpt.
private PointerPointer hashTableFindNodeSpaceOpt(J9HashTablePointer table, StructType entry, PointerPointer head) throws CorruptDataException {
PointerPointer node = head;
StructType nodeStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
while ((node.at(0).notNull()) && (!_equalFunctionWrapper.equal(nodeStruct, entry))) {
node = node.add(1);
if (node == table.nodes().add(table.tableSize())) {
node = table.nodes();
}
nodeStruct = (StructType) DataType.getStructure(_structType, node.getAddress());
}
return node;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer in project openj9 by eclipse.
the class StringTable method iterator.
public SlotIterator<J9ObjectPointer> iterator() {
return new SlotIterator<J9ObjectPointer>() {
private SlotIterator<PointerPointer> hashTableIterator = null;
private long currentIndex = 0;
public boolean hasNext() {
while (true) {
// Is the current iterator good?
if (hashTableIterator != null) {
// Are there still entries?
if (hashTableIterator.hasNext()) {
return true;
}
// Move to the next hash table
currentIndex++;
}
// Are there more hash tables?
if (currentIndex >= _tableCount) {
hashTableIterator = null;
return false;
}
// Get the next hash table iterator
try {
J9HashTablePointer hashTable = J9HashTablePointer.cast(_stringTable._table().at(currentIndex));
HashTable<PointerPointer> currentHashTable = HashTable.fromJ9HashTable(hashTable, false, PointerPointer.class, _hashFn, new StringComparatorFunction<PointerPointer>());
hashTableIterator = currentHashTable.iterator();
} catch (CorruptDataException e) {
raiseCorruptDataEvent("Error getting next item", e, false);
// Keep trying
}
}
}
public J9ObjectPointer next() {
if (hasNext()) {
PointerPointer next = hashTableIterator.next();
return J9ObjectPointer.cast(next);
} else {
throw new NoSuchElementException("There are no more items available through this iterator");
}
}
public VoidPointer nextAddress() {
if (hasNext()) {
return VoidPointer.cast(hashTableIterator.nextAddress());
} else {
throw new NoSuchElementException("There are no more items available through this iterator");
}
}
public void remove() {
throw new UnsupportedOperationException("The image is read only and cannot be modified.");
}
};
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer in project openj9 by eclipse.
the class StringTable method search.
public J9ObjectPointer search(J9ObjectPointer objectPointer) throws CorruptDataException {
UDATA hashCode = _hashFn.hash(PointerPointer.cast(objectPointer));
UDATA tableIndex = getTableIndex(hashCode);
J9HashTablePointer hashTablePtr = getTable(tableIndex);
HashTable<J9ObjectPointer> currentHashTable = HashTable.fromJ9HashTable(hashTablePtr, false, J9ObjectPointer.class, new StringTable.StringHashFunction<J9ObjectPointer>(), new StringTable.StringComparatorFunction<J9ObjectPointer>());
J9ObjectPointer result = currentHashTable.find(objectPointer);
return result;
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer in project openj9 by eclipse.
the class ClassIterator method fromJ9Classloader.
public static Iterator<J9ClassPointer> fromJ9Classloader(J9ClassLoaderPointer loader) throws CorruptDataException {
J9HashTablePointer table = loader.classHashTable();
Iterator<J9ClassPointer> iterator = null;
if (table.listNodePool().notNull()) {
iterator = new ClassIterator(Pool.fromJ9Pool(table.listNodePool(), J9ClassPointer.class, false).iterator());
} else {
iterator = new ArrayIterator<J9ClassPointer>(J9ClassPointer.class, table.tableSize().intValue(), table.nodes()).iterator();
}
return new ClassIterator(iterator);
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9HashTablePointer in project openj9 by eclipse.
the class DumpContendedLoadTable method run.
public void run(String command, String[] args, Context context, PrintStream out) throws DDRInteractiveCommandException {
if (0 != args.length) {
String argument = args[0];
if (argument.equalsIgnoreCase("help")) {
help(out);
return;
}
}
try {
J9JavaVMPointer javaVM = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9HashTablePointer contTable = javaVM.contendedLoadTable();
J9PoolPointer poolPtr = contTable.listNodePool();
Pool<J9ContendedLoadTableEntryPointer> pool = Pool.fromJ9Pool(poolPtr, J9ContendedLoadTableEntryPointer.class);
SlotIterator<J9ContendedLoadTableEntryPointer> poolIterator = pool.iterator();
if (poolIterator.hasNext()) {
out.println("Active class loads:");
while (poolIterator.hasNext()) {
J9ContendedLoadTableEntryPointer entryPointer = poolIterator.next();
String ldStatus = loadingStatusValues.get(entryPointer.status().longValue());
if (null == ldStatus) {
ldStatus = "ILLEGAL VALUE: " + entryPointer.status();
}
J9VMThreadPointer loadingThread = entryPointer.thread();
out.print(String.format("\tClassname: %s;\n\t\tLoader: %s; Loading thread: %s %s\n\t\tStatus: %s; Table entry hash 0x%X\n", entryPointer.className().getCStringAtOffset(0, entryPointer.classNameLength().longValue()), entryPointer.classLoader().formatShortInteractive(), J9VMThreadHelper.getName(loadingThread), loadingThread.formatShortInteractive(), ldStatus, entryPointer.hashValue().longValue()));
}
MonitorIterator iterator = new MonitorIterator(javaVM);
while (iterator.hasNext()) {
Object current = iterator.next();
if (current instanceof J9ThreadMonitorPointer) {
// System Monitor
SystemMonitor monitor = SystemMonitor.fromJ9ThreadMonitor((J9ThreadMonitorPointer) current);
final String monitorName = monitor.getName();
if (monitorName.matches(".*VM class table.*")) {
List<J9ThreadPointer> waitingThreads = monitor.getWaitingThreads();
if (!waitingThreads.isEmpty()) {
out.print("Waiting threads:\n");
for (J9ThreadPointer tp : waitingThreads) {
J9VMThreadPointer vmThread = J9ThreadHelper.getVMThread(tp);
if (vmThread.notNull()) {
out.print(String.format("\t%s\t%s\n", vmThread.formatShortInteractive(), J9VMThreadHelper.getName(vmThread)));
} else {
out.print(String.format("\t%s\t%s\n", tp.formatShortInteractive(), "[osthread]"));
}
}
}
break;
}
}
}
} else {
out.println("No active class loads");
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
Aggregations