use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class MonitorsCommand method systemCommand.
private void systemCommand(FilterOptions filter, PrintStream out) throws DDRInteractiveCommandException {
try {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
MonitorIterator iterator = new MonitorIterator(vm);
while (iterator.hasNext()) {
Object current = iterator.next();
if (current instanceof J9ThreadMonitorPointer) {
// System Monitor
SystemMonitor monitor = SystemMonitor.fromJ9ThreadMonitor((J9ThreadMonitorPointer) current);
writeSystemMonitor(filter, monitor, out);
}
}
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class MonitorsCommand method j9vmthreadCommand.
/**
* See {@link MonitorsCommand#helpCommand(String[], PrintStream)} for
* function documentation
*
* @param args
* command args
* @param out
* the output stream
* @throws DDRInteractiveCommandException
*/
private void j9vmthreadCommand(String[] args, PrintStream out) throws DDRInteractiveCommandException {
if (args.length < 2) {
out.println("This command takes one address argument: \"!monitors j9vmthread <address>\"");
return;
}
try {
long address = CommandUtils.parsePointer(args[1], J9BuildFlags.env_data64);
VoidPointer ptr = VoidPointer.cast(address);
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9VMThreadPointer thread = null;
GCVMThreadListIterator threadIterator = GCVMThreadListIterator.from();
while (threadIterator.hasNext()) {
if (ptr.equals(threadIterator.next())) {
thread = J9VMThreadPointer.cast(ptr);
}
}
if (null == thread) {
throw new DDRInteractiveCommandException(String.format("Could not find any j9vmthread at address %s\n", ptr.getHexAddress()));
}
// Step 1: Print the general info for the VM and native threads:
out.println(String.format("!j9vmthread 0x%08x\t!j9thread 0x%08x\t// %s", thread.getAddress(), thread.osThread().getAddress(), J9VMThreadHelper.getName(thread)));
printMonitorsForJ9VMThread(out, vm, thread);
printMonitorsForJ9Thread(out, vm, thread.osThread());
} catch (CorruptDataException e) {
throw new DDRInteractiveCommandException(e);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class WalkInternTableCommand method printSharedTableStructure.
/**
* typedef struct J9SharedInvariantInternTable {
* UDATA (*performNodeAction)(struct J9SharedInvariantInternTable *sharedInvariantInternTable, struct J9SharedInternSRPHashTableEntry *node, UDATA action, void* userData);
* UDATA flags;
* omrthread_monitor_t *tableInternFxMutex;
* struct J9SRPHashTable* sharedInvariantSRPHashtable;
* struct J9SharedInternSRPHashTableEntry* headNode;
* struct J9SharedInternSRPHashTableEntry* tailNode;
* J9SRP* sharedTailNodePtr;
* J9SRP* sharedHeadNodePtr;
* U_32* totalSharedNodesPtr;
* U_32* totalSharedWeightPtr;
* struct J9ClassLoader* systemClassLoader;
*} J9SharedInvariantInternTable;
*
* typedef struct J9SRPHashTable {
* const char* tableName;
* struct J9SRPHashTableInternal* srpHashtableInternal;
* UDATA (*hashFn)(void *key, void *userData);
* UDATA (*hashEqualFn)(void *existingEntry,void *key, void *userData);
* void (*printFn)(J9PortLibrary *portLibrary, void *key, void *userData);
* struct J9PortLibrary* portLibrary;
* void* functionUserData;
* UDATA flags;
* } J9SRPHashTable;
*
* typedef struct J9SRPHashTableInternal {
* U_32 tableSize;
* U_32 numberOfNodes;
* U_32 entrySize;
* U_32 nodeSize;
* U_32 flags;
* J9SRP nodes;
* J9SRP nodePool;
* } J9SRPHashTableInternal;
*
* Prints the info for three VM structures that are shown above and used for shared intern table.
* 1. J9SharedInvariantInternTable
* 2. J9SRPHashTable
* 3. J9SRPHashTableInternal
*
* @param out PrintStream
* @throws CorruptDataException
* @return void
*/
private void printSharedTableStructure(PrintStream out) throws CorruptDataException {
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9SharedInvariantInternTablePointer sharedInternTable;
sharedInternTable = vm.sharedInvariantInternTable();
if (!sharedInternTable.isNull()) {
out.println(sharedInternTable.formatFullInteractive());
}
out.append("Total Shared Weight : " + sharedInternTable.totalSharedWeightPtr().at(0).longValue() + nl);
J9SRPHashTablePointer srphashtable = sharedInternTable.sharedInvariantSRPHashtable();
if (!srphashtable.isNull()) {
out.println(srphashtable.formatFullInteractive());
}
J9SRPHashTableInternalPointer srpHashTableInternal = srphashtable.srpHashtableInternal();
if (!srpHashTableInternal.isNull()) {
out.println(srpHashTableInternal.formatFullInteractive());
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class WalkInternTableCommand method walkSharedTable.
/**
* Walks through the shared string intern table nodes and prints the info about them on each line.
* @param out
* @throws CorruptDataException
* @return void
*/
private void walkSharedTable(PrintStream out) throws CorruptDataException {
int totalWeight = 0;
J9JavaVMPointer vm = J9RASHelper.getVM(DataType.getJ9RASPointer());
J9SharedInvariantInternTablePointer sharedInternTable = vm.sharedInvariantInternTable();
/* Check if there is sharedInternTable before to go further */
if (!sharedInternTable.isNull()) {
J9SharedInternSRPHashTableEntryPointer currentEntry = sharedInternTable.headNode();
int counter = 1;
out.append("=================================================================================" + nl);
out.append(tab(2) + "WALKING SHARED INTERN SRP HASHTABLE (SRPHashTable " + sharedInternTable.sharedInvariantSRPHashtable().getHexAddress() + ")" + nl);
out.append(tab(2) + "FROM: MRU (MOST RECENTLY USED)" + nl);
out.append(tab(2) + "TO: LRU (LEAST RECENTLY USED)" + nl);
out.append("=================================================================================" + nl);
while (!currentEntry.isNull()) {
out.append(counter + "." + tab + "Shared Table Entry < !J9SharedInternSRPHashTableEntry " + currentEntry.getHexAddress() + " Flags: " + currentEntry.flags().getHexValue() + " IWeight: " + currentEntry.internWeight().longValue() + " IsUTF8Shared: " + currentEntry.flags().allBitsIn(J9SharedInternSRPHashTableEntry.STRINGINTERNTABLES_NODE_FLAG_UTF8_IS_SHARED) + ">" + tab + "UTF8 <Add: " + currentEntry.utf8SRP().getHexAddress() + " Data: \"" + J9UTF8Helper.stringValue(currentEntry.utf8SRP()) + "\">" + nl);
totalWeight += currentEntry.internWeight().longValue();
currentEntry = currentEntry.nextNode();
counter++;
}
out.append("Total Weight = " + totalWeight + nl);
out.append("=================================================================================" + nl);
out.append(tab(2) + "WALKING SHARED INTERN SRP HASHTABLE COMPLETED" + nl);
out.append("=================================================================================" + nl);
}
}
use of com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer in project openj9 by eclipse.
the class VmCheckCommand method verifyJ9Class.
private boolean verifyJ9Class(J9JavaVMPointer javaVM, PrintStream out, J9ClassPointer classPointer) throws CorruptDataException {
boolean passed = verifyJ9ClassHeader(javaVM, out, classPointer);
if (!classPointer.classLoader().isNull()) {
J9MemorySegmentPointer segment = classPointer.classLoader().classSegments();
segment = findSegmentInClassLoaderForAddress(classPointer, segment);
if (segment.isNull()) {
reportError(out, "class=0x%s not found in classLoader=0x%s", Long.toHexString(classPointer.getAddress()), Long.toHexString(classPointer.classLoader().getAddress()));
passed = false;
}
}
if (!verifyJ9ClassSubclassHierarchy(javaVM, out, classPointer)) {
passed = false;
}
return passed;
}
Aggregations