Search in sources :

Example 71 with J9JavaVMPointer

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);
    }
}
Also used : MonitorIterator(com.ibm.j9ddr.vm29.j9.walkers.MonitorIterator) SystemMonitor(com.ibm.j9ddr.vm29.j9.SystemMonitor) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) J9ThreadMonitorPointer(com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 72 with J9JavaVMPointer

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);
    }
}
Also used : GCVMThreadListIterator(com.ibm.j9ddr.vm29.j9.gc.GCVMThreadListIterator) VoidPointer(com.ibm.j9ddr.vm29.pointer.VoidPointer) J9VMThreadPointer(com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer) DDRInteractiveCommandException(com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) CorruptDataException(com.ibm.j9ddr.CorruptDataException)

Example 73 with J9JavaVMPointer

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());
    }
}
Also used : J9SRPHashTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9SRPHashTablePointer) J9SRPHashTableInternalPointer(com.ibm.j9ddr.vm29.pointer.generated.J9SRPHashTableInternalPointer) J9SharedInvariantInternTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9SharedInvariantInternTablePointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)

Example 74 with J9JavaVMPointer

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);
    }
}
Also used : J9SharedInvariantInternTablePointer(com.ibm.j9ddr.vm29.pointer.generated.J9SharedInvariantInternTablePointer) J9JavaVMPointer(com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer) J9SharedInternSRPHashTableEntryPointer(com.ibm.j9ddr.vm29.pointer.generated.J9SharedInternSRPHashTableEntryPointer)

Example 75 with J9JavaVMPointer

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;
}
Also used : J9MemorySegmentPointer(com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)

Aggregations

J9JavaVMPointer (com.ibm.j9ddr.vm29.pointer.generated.J9JavaVMPointer)57 CorruptDataException (com.ibm.j9ddr.CorruptDataException)49 DDRInteractiveCommandException (com.ibm.j9ddr.tools.ddrinteractive.DDRInteractiveCommandException)39 J9ClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassPointer)23 J9VMThreadPointer (com.ibm.j9ddr.vm29.pointer.generated.J9VMThreadPointer)17 UDATA (com.ibm.j9ddr.vm29.types.UDATA)13 J9ROMClassPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ROMClassPointer)10 ClassSegmentIterator (com.ibm.j9ddr.vm29.j9.walkers.ClassSegmentIterator)8 J9ObjectPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ObjectPointer)8 J9MemorySegmentPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MemorySegmentPointer)6 PatternString (com.ibm.j9ddr.util.PatternString)5 MonitorIterator (com.ibm.j9ddr.vm29.j9.walkers.MonitorIterator)5 ROMClassesIterator (com.ibm.j9ddr.vm29.j9.walkers.ROMClassesIterator)5 U8Pointer (com.ibm.j9ddr.vm29.pointer.U8Pointer)5 J9ClassLoaderPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ClassLoaderPointer)5 MM_HeapRegionManagerPointer (com.ibm.j9ddr.vm29.pointer.generated.MM_HeapRegionManagerPointer)5 Table (com.ibm.j9ddr.tools.ddrinteractive.Table)4 GCHeapRegionDescriptor (com.ibm.j9ddr.vm29.j9.gc.GCHeapRegionDescriptor)4 J9MethodPointer (com.ibm.j9ddr.vm29.pointer.generated.J9MethodPointer)4 J9ThreadMonitorPointer (com.ibm.j9ddr.vm29.pointer.generated.J9ThreadMonitorPointer)4